Print at Dec 16, 2025, 11:37:21 PM

Posted by Puybaret at Oct 31, 2022, 3:36:14 PM
Re: SweetHome3DJS model not saved in sh3d file
I have a problem where the online version does not store models chosen correctly.
The Online version stores models and textures differently and the sh3d file that it handles can be opened with the desktop version if your server 18.135.111.130:8080 can be reached.
If you want to include in the sh3d file all the models it uses, just override createHomeOutputStream in a subclass of HomeServerRecorder to return a DefaultHomeOutputStream instance which will write also models and textures, for example:
new DefaultHomeOutputStream(new BufferedOutputStream(new FileOutputStream(homeFile)),
compressionLevel, ContentRecording.INCLUDE_ALL_CONTENT, false, new HomeXMLExporter());
Then instantiate this new class in writeHomeEdits.jsp instead of HomeServerRecorder class.

But keep in mind that this will create more traffic between the server and JS client, and the sh3d files stored on the server will take much more room. I would rather recommend to create an export function that will read a sh3d file stored on the server and return the content of a full sh3d file.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator