Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 52
Posts: 52   Pages: 6   [ Previous Page | 1 2 3 4 5 6 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 229430 times and has 51 replies Next Thread
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9381
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sweet Home 3D JS Online

Here are the instructions you can use to add more furniture to the Online version.
First, gather the additional 3D models you want in a SH3F file with the Furniture Library Editor. Let's say you called it additionalLibrary.sh3f.
Then you should use the PropertiesToJson tool included in SweetHome3DJS source code to convert .properties files to their equivalent .json files and extract 3D model and icon files:
- Compile the com.eteks.sweethome3d.json.PropertiesToJson class in SweetHome3DJS root folder with the following command:

javac -cp tools/json/lib/json-20190722.jar -d tools/json/src tools/json/src/com/eteks/sweethome3d/json/PropertiesToJson.java

- In the same folder, run PropertiesToJson with the following command (in one line):

java -cp tools/json/lib/json-20190722.jar:tools/json/src com.eteks.sweethome3d.json.PropertiesToJson
/path/to/the/folder/where/is/stored/additionalLibrary
additionalLibrary.sh3f
/path/to/apache-tomcat-folder/webapps/SweetHome3DJS-7.1/lib/resources
additionalLibrary
/path/to/apache-tomcat-folder/webapps/SweetHome3DJS-7.1/lib/resources/models/additionalLibrary
lib/resources/models/additionalLibrary
true

PropertiesToJson requires the 7 following arguments:
1. the folder where you stored additionalLibrary.sh3f
2. additionalLibrary.sh3f, the furniture library file to convert
3. the output folder where the .json files will be saved (if you used Tomcat to test the war file, it should be the subfolder webapps/SweetHome3DJS-7.1/lib/resources of Tomcat installation folder, but this could be also the subfolder deploy/lib/resources of SweetHome3DJS root folder).
4. additionalLibrary, the base name of the .json files
5. the folder where 3D models and icons will extracted (I recommend to use a subfolder to avoid conflicts with some other libraries stored in models)
6. the path of the 3D models and icons relative to index.jsp (the folder where 3D models can be found from the furnitureResourcesURLBase property added to index.jsp in the following instructions)
7. true (it indicates that 3D models and icons should be extracted, using false won't extract them)

For example, if you try with BlendSwap-CC-0.sh3f available here saved in SweetHome3DJS root folder and Tomcat installation folder in /Applications/apache-tomcat-9.0.41, you'll get the following command:

java -cp tools/json/lib/json-20190722.jar:tools/json/src com.eteks.sweethome3d.json.PropertiesToJson . BlendSwap-CC-0.sh3f /Applications/apache-tomcat-9.0.41/webapps/SweetHome3DJS-7.1/lib/resources BlendSwap-CC-0 /Applications/apache-tomcat-9.0.41/webapps/SweetHome3DJS-7.1/lib/resources/models/BlendSwap-CC-0 lib/resources/models/BlendSwap-CC-0 true


Once, your .json, 3D models and icons files are ready, you'll have to tell the Online version to take them into account with the two following changes:
- around the end of index.jsp, add furnitureCatalogURLs and furnitureResourcesURLBase properties to JavaScript application configuration, to specify the list of furniture catalogs and the base URL for their 3D models and icons.
For example, the beginning of application declaration:

var application = new SweetHome3DJSApplication(
{readHomeURL: urlBase + "/readHome.jsp?home=%s",

should become:

var application = new SweetHome3DJSApplication(
{furnitureCatalogURLs: [urlBase + "/lib/resources/DefaultFurnitureCatalog.json",
urlBase + "/lib/resources/additionalLibrary.json"],
furnitureResourcesURLBase: urlBase + "/",
readHomeURL: urlBase + "/readHome.jsp?home=%s",

And if you try with BlendSwap-CC-0 library, it will become:

var application = new SweetHome3DJSApplication(
{furnitureCatalogURLs: [urlBase + "/lib/resources/DefaultFurnitureCatalog.json",
urlBase + "/lib/resources/BlendSwap-CC-0.json"],
furnitureResourcesURLBase: urlBase + "/",
readHomeURL: urlBase + "/readHome.jsp?home=%s",

(citing DefaultFurnitureCatalog.json isn't mandatory if you don't want to keep the default library).

- The additional library managed by user preferences in writeHomeEdits.jsp should be added in the declaration of serverUserPreferences instance.
Therefore, the following declaration:

serverUserPreferences = new ServerUserPreferences(
new URL [] {new URL(serverBaseUrl, "lib/resources/DefaultFurnitureCatalog.json")}, serverBaseUrl,
new URL [] {new URL(serverBaseUrl, "lib/resources/DefaultTexturesCatalog.json")}, serverBaseUrl);

should become:

serverUserPreferences = new ServerUserPreferences(
new URL [] {new URL(serverBaseUrl, "lib/resources/DefaultFurnitureCatalog.json"),
new URL(serverBaseUrl, "lib/resources/additionalLibrary.json")}, serverBaseUrl,
new URL [] {new URL(serverBaseUrl, "lib/resources/DefaultTexturesCatalog.json")}, serverBaseUrl);


And for BlendSwap-CC-0 library, it will become:

serverUserPreferences = new ServerUserPreferences(
new URL [] {new URL(serverBaseUrl, "lib/resources/DefaultFurnitureCatalog.json"),
new URL(serverBaseUrl, "lib/resources/BlendSwap-CC-0.json")}, serverBaseUrl,
new URL [] {new URL(serverBaseUrl, "lib/resources/DefaultTexturesCatalog.json")}, serverBaseUrl);


Hope you can handle it.
There are other way to generate .json files without a SH3F file, but it depends on your furniture library configuration.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[May 1, 2023, 11:21:12 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9381
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sweet Home 3D JS Online

I forgot to mention textures libraries. Actually, it works more or less the same with SH3T files and the two additional texturesCatalogURLs / texturesResourcesURLBase to configure application JavaScript variable in index.jsp.

For example, if you try with Contributions.sh3t available here saved in SweetHome3DJS root folder and Tomcat installation folder in /Applications/apache-tomcat-9.0.41, the following PropertiesToJson command will extract .json and texture image files :

java -cp tools/json/lib/json-20190722.jar:tools/json/src com.eteks.sweethome3d.json.PropertiesToJson . Contributions.sh3t /Applications/apache-tomcat-9.0.41/webapps/SweetHome3DJS-7.1/lib/resources Contributions /Applications/apache-tomcat-9.0.41/webapps/SweetHome3DJS-7.1/lib/resources/textures/Contributions lib/resources/textures/Contributions true

Comparing with the PropertiesToJson command previously used for furniture libraries, you just need to change file and folder names.

Then, adding the Contributions library to the configuration of JavaScript application in index.jsp will give:

var application = new SweetHome3DJSApplication(
{furnitureCatalogURLs: [urlBase + "/lib/resources/DefaultFurnitureCatalog.json",
urlBase + "/lib/resources/BlendSwap-CC-0.json"],
furnitureResourcesURLBase: urlBase + "/",
texturesCatalogURLs: [urlBase + "/lib/resources/DefaultTexturesCatalog.json",
urlBase + "/lib/resources/Contributions.json"],
texturesResourcesURLBase: urlBase + "/",
readHomeURL: urlBase + "/readHome.jsp?home=%s",

and adding it to the textures libraries managed by user preferences in writeHomeEdits.jsp will lead to the following declaration:

serverUserPreferences = new ServerUserPreferences(
new URL [] {new URL(serverBaseUrl, "lib/resources/DefaultFurnitureCatalog.json"),
new URL(serverBaseUrl, "lib/resources/BlendSwap-CC-0.json")}, serverBaseUrl,
new URL [] {new URL(serverBaseUrl, "lib/resources/DefaultTexturesCatalog.json"),
new URL(serverBaseUrl, "lib/resources/Contributions.json")}, serverBaseUrl);

Good luck!
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[May 1, 2023, 7:11:12 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
son87a
Newbie




Joined: Oct 28, 2021
Post Count: 12
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sweet Home 3D JS Online

I see the model file can be in zip format, I thought it is possible to add a password to zip the file to protect my proprietary model files? Do you have any suggestions?
[May 4, 2023, 2:32:09 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9381
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sweet Home 3D JS Online

You could grant the right to download 3D model zip files only to some identified people.
If needed, the URLs in furniture libraries can be more complex URLs which call a service on the server, similarly to the service specified by readResourceURL property in application configuration on the Online version of this server. It uses the JSP page readResource.jsp?path=xxx to ensure that only a given user can access to the resources he imported.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[May 4, 2023, 4:01:19 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9381
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sweet Home 3D JS Online

And about protecting your model file with a password, this is not possible because JSZip doesn't support this feature yet, and even when it will be supported, Sweet Home 3D JS would need that password to decode the model files.
Therefore, the password would have to be available somewhere in the configuration of Sweet Home 3D JS, making it also available to anyone wanting to find it.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[May 4, 2023, 9:16:44 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9381
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sweet Home 3D JS Online

Hello,

I’m happy to announce that I just released two new apps based on Sweet Home 3D JS, one for iOS and the other for Android.
As explained in this article, these apps don’t require a connection to Internet to work and are able to import and export SH3D / SH3X files to share your designs on another smartphone, tablet or computer where Sweet Home 3D is installed or within a browser running Sweet Home 3D Online.



These apps are not free but remain based on the free version of Sweet Home 3D JS that I improved with the following features:
- A new About dialog box was added and replaces the status bar in the Online version.
- Sweet Home 3D JS now includes some new APIs to store home data using IndexedDB storage with auto recovery management.
- Drag and drop support was added to images import process of the Online version.
- Panes in Online version under tablets are now arranged the same way as in desktop version.
- Application "sandwich" menu of the Online version is displayed in a separate div to ensure it's always visible in the toolbar.
- Sort and Display column menus were added on tablets.
- Combo boxes closing was fixed.
- The last touched point is now used as the final point when wall, room, polyline and dimension creation tools are used and the user clicks on another tool.
- Keeping the finger on a button of the 3D navigation panel on touch device now repeats rotation or zoom.

All these changes were released in Sweet Home 3D JS 7.1.2, still based on Sweet Home 3D 7.1 and can be tested in Sweet Home 3D Online which was updated too.

Hope you'll like this new version smile
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
----------------------------------------
[Edit 2 times, last edit by Puybaret at Sep 8, 2023, 12:37:05 AM]
[Sep 7, 2023, 6:31:44 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
JonnyD
Member




Joined: Jun 1, 2019
Post Count: 20
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sweet Home 3D JS Online

I’ve just bought it 😁
[Sep 7, 2023, 7:32:51 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9381
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sweet Home 3D JS Online

Thanks JonnyD. Hope you’ll like it and find it useful!
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Sep 8, 2023, 12:33:57 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Paul6552
Newbie



Österreich
Joined: Nov 2, 2022
Post Count: 2
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sweet Home 3D JS Online

This is wonderful software. Thanks for that. Although I dont need the app, I'm going to buy the app today to give you some support!

Why are you actually developing two programs? Once as an installation and once on the web?

Isn't it incredibly time-consuming to maintain/develop two things?

Is the project somewhere on Github? I'm a Javascript / React developer myself and maybe I can contribute something.
[Apr 3, 2024, 2:45:04 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9381
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sweet Home 3D JS Online

Thank you Paul.

The two JS solutions don't provide the same way to save files: the Online version saves your design on sweethome3d.com server, whereas the App stores applications save them in local files (IndexedDB or plain files) without the need of a connection to Internet and registration.

This takes some time to develop these solutions, but this was interesting to develop and the App stores sales bring some revenues which help me to spend more time on improving and maintaining Sweet Home 3D.

The project isn't on GitHub, but on SourceForge.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Apr 6, 2024, 12:16:07 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 52   Pages: 6   [ Previous Page | 1 2 3 4 5 6 | Next Page ]
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

  Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads  
© Copyright 2024 Space Mushrooms - All rights reserved