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 233297 times and has 51 replies Next Thread
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 tried edit code after google. Wrap try in {}
Its working but I don't know write in finally statement.
Sorry, I'm working with PHP, and don't know Java.
Can you fix that ?

try {InputStream input = new FileInputStream(homeFile);
ByteArrayOutputStream output = new ByteArrayOutputStream();
byte[] buffer = new byte[8096];
int size;
while ((size = input.read(buffer)) != -1) {
output.write(buffer, 0, size);
}
homeFileContent = output.toByteArray();
}
finally{
// write something here ?
}



try {OutputStream servletOut = response.getOutputStream();
servletOut.write(homeFileContent);
}
finally{
// write something here ?
}

[Oct 29, 2021, 12:49: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: 9388
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sweet Home 3D JS Online

You don't have to write anything in finally blocks (note that they don't even exist in the released version of readHome.jsp). I guess you should learn Java before going further...
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Oct 29, 2021, 2:12:31 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

Thank you for your time !
[Oct 30, 2021, 2:55:30 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: 9388
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sweet Home 3D JS Online

A new version of Sweet Home 3D JS Online was released last week-end with many new features. See this blog post for more information.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Nov 15, 2021, 8:24:11 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
xato
Newbie



United Kingdom
Joined: Apr 28, 2022
Post Count: 1
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sweet Home 3D JS Online

Hi, first time forum poster, couldn't see a search option to ask about this, I love your software!!

I was just wondering if there was a reason why it runs soo much faster in the browser than natively.

Is there anything I can do on my M1 Mac to speed it up? Is this a Java issue?
[Apr 28, 2022, 12:21:05 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: 9388
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sweet Home 3D JS Online

For your information, I just changed the user interface of the Online version for large touch devices like tablets, to take profit of the additional space they propose. It now shows the 4 classical resizable panes of the desktop version and a larger choice of models in the catalog, either in landscape format:



or in portrait format:



Note also that from the release of version 7.0, it's now possible to modify openings in Sweet Home 3D JS Online and to select a material directly in the 3D model preview in the furniture materials modification dialog box.




I was just wondering if there was a reason why it runs soo much faster in the browser than natively.
I wonder on which particular point you see such a performance difference because I didn't notice it that much.
Loading 3D models is slower with the Online version because Java threads are more efficient than JavaScript workers when there are a lot of data to retrieve (finally I even didn't use JavaScript workers).
The 3D view might run faster at a given size at screen, probably because the WebGL rendering I programmed is simpler than the Java 3D / JOGL / OpenGL layers.
But I also noticed that computing window holes in the walls is much slower in JavaScript and wonder if it's because JavaScript proposes only high precision decimal numbers (you can see this difference when you try to change level in the large building examples of this tip).
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Aug 11, 2022, 5:04:11 PM] 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

I plan everything in the online editor but what is incredibly annoying is that the windows (walkthrough and sketch) cannot be placed in their own tabs.

Please separate these two views so that the sketch is on one screen and the rendering (virtual walkthrough of the house) on the other.

Will this feature be available in the next version?
[Dec 26, 2022, 12:54:30 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: 9388
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sweet Home 3D JS Online

Sorry, I don’t think so. You can already change their size with the separator between them.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Dec 26, 2022, 10:59:56 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
TwistedLincoln
Member




Joined: Jan 18, 2011
Post Count: 29
Status: Offline
Reply to this Post  Reply with Quote 
Re: Sweet Home 3D JS Online

I was able to compile the .war file and get it to run properly using Tomcat. It's fantastic, and incredibly fast! However I can't seem to figure out how to add additional furniture on the server side. Any guidance would be greatly appreciated.
[Apr 30, 2023, 11:27:59 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: 9388
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 
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