Print at Apr 13, 2021, 2:21:31 AM

Posted by Puybaret at Jun 7, 2016, 2:00:34 PM
Re: Export to HTML5 plug-in
As I received an other request similar to lcgamboa's one, I finally programmed the additional Export to XML/OBJ plug-in (see links at end of message) that proposes the Tools > Export to XML/OBJ format menu item able to generate a ZIP file that contains:
- Home.xml entry with all the data of the edited home at XML format (including furniture visible or not, walls, rooms, texts, dimensions lines, polylines...)
- HomeStructure/Home.obj that contains the home structure computed by Sweet Home 3D classes (wall, rooms, ground and 3D labels)
- 3D models only at OBJ+MTL format (models at other format will be converted)
- furniture icons, texture images and other images.

This generated ZIP file is compatible with Sweet Home 3D JS viewer (it just contains more data that the home file generated by Export to HTML5 plug-in, and will be readable with Sweet Home 3D 5.3 too, once the upcoming changes in .sh3d file format will be programmed.
The XML schema used in the Home.xml entry should be quite straightforward. Its elements and attributes match com.eteks.sweethome3d.model API (except for the classes starting by Home which is omitted, like HomeLight class which becomes light element). An exported Home instance will have an XML structure looking like this:

<home>
<furnitureVisibleProperty/>
<property/>
<environment/>
<compass/>
<observerCamera/>
<camera/>
<level/><level/>
<pieceOfFurniture/><doorOrWindow/><light/>
<wall/><wall/><wall/>
<room/><room/>
<polyline/><polyline/>
<dimensionLine/><dimensionLine/>
<label/>
</home>

At the moment, the only elements which have an id are level and wall elements because they can be referenced in other elements. Lengths are in centimeters and angles in radians. If needed, look at com.eteks.sweethome3d.plugin.exportxml.HomeXMLExporter class source code included in the plug-in or ask for more information in this forum. A more complete description of the schema will be available with next Sweet Home 3D release.

This plug-in reuses the same classes as Export to HTML5 plug-in, that's why it uses the same version number 1.1.

Hope you'll find all kind of use for your Sweet Home 3D data smile

Download links for Export to XML/OBJ plug-in:
Export to XML/OBJ plug-in 1.1 was released on 06/07/2016
Export to XML/OBJ plug-in 1.2 was released on 12/13/2016
Export to XML/OBJ plug-in 1.3 was released on 10/10/2017
----------------------------------------
Attachment Home.xml (14808 bytes) (Download count: 386) (Example of exported home at XML format)

----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer