Sweden
Joined: Apr 15, 2010
Post Count: 2
Status:
Offline
How to import furniture in Applet
Hi I'm playing around with Sweet Home 3D and have managed to serve it as an applet from a webserver. Only problem is I have no furniture in the applet, how and where do I put which files to remedy this?
Important note: in no case, I give you (or other people reading this thread) the authorization to host unmodified versions of the files furnitureCatalog.zip, additionalFurnitureCatalog.zip and texturesCatalog.zip on your server. You must reference 3D model and icon files hosted on your server, and not files on sweethome3d.eu server. Don't host the files furnitureCatalog.zip, additionalFurnitureCatalog.zip and texturesCatalog.zip on your server if you don't understand the exact meaning of the required changes.
[01/18/2011 - Update from developer : In version 2.4, the two furnitureResourcesURLBase and texturesResourcesURLBase parameters were added to SweetHome3DApplet class to simplify catalogs deployment. Thus, the furnitureCatalog.zip, additionalFurnitureCatalog.zip and texturesCatalog.zip hosted on this server don't contain absolute URLs anymore but URLs relative to the furnitureResourcesURLBase and texturesResourcesURLBase parameters I added to the applet of the Online version. Feel free to use these files unmodified now, as long as you take care to change the URL base to avoid using models hosted on sweethome3d.com server in your applet.]
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
----------------------------------------
[Edit 1 times,
last edit by Puybaret at Jan 18, 2011, 7:18:35 PM]
Joined: Apr 26, 2010
Post Count: 8
Status:
Offline
Re: How to import furniture in Applet
I just did following but Applet is still loading without any feature. Added the following parameters in SweetHome3DApplet.html
var parameters = {java_arguments:"-Xmx512m -Dcom.eteks.sweethome3d.deploymentInformation=Online", showMemoryStatus:"true", userLanguage:"en", furnitureCatalogURLs:"/online/furnitureCatalog.zip /online/additionalFurnitureCatalog.zip", texturesCatalogURLs:"/online/texturesCatalog.zip",
listHomesURL:"", readHomeURL:"", writeHomeURL:""
};
- I downloaded the same Catalogs from in zip archives you linked above. - Then uncompressed these zip files to modify the reference URLS to my own server and then again zipped in the same way. - I downloaded one or two models from the sweethome3d.eu as were linked in the *catalog.properties and placed on my own server with the same directory structure. I selected only one or two items/models to test the working.
the final *.properties files were as below. I am not disclosing the actual URL considering the privacy. but I tested the urls after placing the models if they work on direct access or not. and they are actually working. furnitureCatalog.zip!\PluginFurnitureCatalog.properties
name#1=Triple window category#1=Doors and windows icon#1=http://my_url/models/contributions/DianaWindow.png model#1=jar:http://my_url/models/contributions/DianaWindow.zip!/DianaWindow.obj width#1=389.6 depth#1=25.6 height#1=210.0 movable#1=false doorOrWindow#1=true creator#1=Artist373
lastly, is there any way to download all the models from sweethome3d.eu in an archive rather than downloading them each individually. Ofcourse if it's authorised by sweethome3d.eu.
France
Joined: Nov 7, 2005
Post Count: 9423
Status:
Offline
Re: How to import furniture in Applet
The first thing I would do is to simply import the ZIP files you created in the offline version of Sweet Home 3D after changing their extension from zip to sh3f, and check if the models listed in them appear in Sweet Home 3D catalog. If this succeeds, you should check if http://my_url/online/furnitureCatalog.zip is accessible. As you kept a slash in front of "/online/furnitureCatalog.zip", online directory should be at root. If you remove the first slash from "/online/furnitureCatalog.zip", online will be relative to applet "codebase" attribute.
lastly, is there any way to download all the models from sweethome3d.eu in an archive rather than downloading them each individually. Ofcourse if it's authorised by sweethome3d.eu.
The two things that forbids me to do this is time and bandwidth. Time is a concern since I would have to update this archive each time I add models in additionalFurnitureCatalog.zip, and this would be one more task I shouldn't forget. Bandwidth is my main concern since this archive weights 32 MB at this time, and I'm always frightened by the idea of hosting such a big file (Sweet Home 3D installers are big files too but they are hosted on SourceForge.net servers).
If you feel comfortable with regular expressions, you can transform the lines containing ".zip" and ".png" in PluginFurnitureCatalog.properties into wget commands, taking care of subdirectories. If not, the only solution I see at this time is to create that file on demand and publish it temporarily. If you don't have a better idea, send me a private message or an email.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
Joined: Apr 26, 2010
Post Count: 8
Status:
Offline
Re: How to import furniture in Applet
The first thing I would do is to simply import the ZIP files you created in the offline version of Sweet Home 3D after changing their extension from zip to sh3f, and check if the models listed in them appear in Sweet Home 3D catalog. If this succeeds, you should check if http://my_url/online/furnitureCatalog.zip is accessible. As you kept a slash in front of "/online/furnitureCatalog.zip", online directory should be at root. If you remove the first slash from "/online/furnitureCatalog.zip", online will be relative to applet "codebase" attribute.
Great!!! it was the slash. I actually was using a specific folder named SH3D as the application on the root. but didn't remove the "/". after your post I just got that and removed the "/" before "online" to use it as relative to "codebase" which in my case was "http://my_url/SH3D/"
lastly, is there any way to download all the models from sweethome3d.eu in an archive rather than downloading them each individually. Ofcourse if it's authorised by sweethome3d.eu.
The two things that forbids me to do this is time and bandwidth. Time is a concern since I would have to update this archive each time I add models in additionalFurnitureCatalog.zip, and this would be one more task I shouldn't forget. Bandwidth is my main concern since this archive weights 32 MB at this time, and I'm always frightened by the idea of hosting such a big file (Sweet Home 3D installers are big files too but they are hosted on SourceForge.net servers).
I got that. it's understandable.
If you feel comfortable with regular expressions, you can transform the lines containing ".zip" and ".png" in PluginFurnitureCatalog.properties into wget commands, taking care of subdirectories.
Won't it be the other part from downloading the catalogs from sweethome3d server. the hell is actually to download each zip file :P any ways. the use of regular expressions in "*.properties" is also a good for me but ofcourse I would have to download the zip files separately each.
If not, the only solution I see at this time is to create that file on demand and publish it temporarily. If you don't have a better idea, send me a private message or an email.
I'll contact you via email. That would be great and so kind of you. Thanks a lot.
France
Joined: Nov 7, 2005
Post Count: 9423
Status:
Offline
Re: How to import furniture in Applet
Could you paste here the properties of one of your object, as well as the params you used in your applet?
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
I tried to run the code locally as an applet within Eclipse, and v3.5 source is a little different from what is explained in this post: 1.There is no zip files for catalog or texture. All the models and textures are individual files in io/resources folder. The .properties files are located in io folder 2.Parameters has to be set in Run Configurations option of Eclipse
So I followed the instructions and did the following: 1.Change path for models and textures in .properties files, as
icon#1=./resources/bed140x190.png
model#1=./resources/bed140x190.obj
2.Set parameters as followed: Name:pluginFurnitureCatalogURLs Value:"./io/"
Name:pluginTexturesCatalogURLs Value:"./io/"
However, the applet run without any models on the top left section.
I have intentionally changed the path for models to a wrong one then Eclipse produced error of "Unknown resource", which means the paths I used above should be processed properly.
About the parameters, I have tried both relative and absolute path (C:/...) but none worked.
France
Joined: Nov 7, 2005
Post Count: 9423
Status:
Offline
Re: How to import furniture in Applet
The program doesn't handle paths but URLs. I hoped that the URL suffix in the parameter names would be enough to suggest it.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator