turkey
Joined: Aug 14, 2018
Post Count: 3
Status:
Offline
Adding markers that won't be lost when I export to obj
Hi, this question is about importing sweet home 3d generated obj files into THREE.js and detecting points of interest from within javascript. I can see that the object names, material names and coordinates are exported into the obj file. Is there any way to influence what name will be used for a certain 3d object?
Ideally, I would like to leave markers on the floor (tiny boxes or balls), name them and when the model is loaded with THREE.OBJLoader, I would like to see their names inside the javascript object. For that, the model needs to be exported with customizable names. I tried naming objects, but the sh3d exporter renames them according to some algorithm so I can't get the names back when I load the object.
I could also find the centers of floors within javascript. Not ideal, but worth a try. For that, I tried creating a model with two rooms with separate floors, but the exported obj file only has ground_1.
Another alternative is to find out how the floor maps into 3d coordinates and inject the points of interest from within javascript, but that requires me to do extra programming work.
turkey
Joined: Aug 14, 2018
Post Count: 3
Status:
Offline
Re: Adding markers that won't be lost when I export to obj
I created another house plan, exported to obj and it outputted g room_ objects. I am currently experimenting on getting the bounding spheres of `g room_` objects and calculating their centers. It looks promising so far.
turkey
Joined: Aug 14, 2018
Post Count: 3
Status:
Offline
Re: Adding markers that won't be lost when I export to obj
I managed to find the center coordinates of floor bounding spheres in javascript. The spheres also get their unique names from the sweethome3d obj export. Appears to be working so far.
France
Joined: Nov 7, 2005
Post Count: 9420
Status:
Offline
Re: Adding markers that won't be lost when I export to obj
Nice try!
You could also use Sweet Home 3D JS Viewer to display SH3D files. Its JavaScript API lets you directly handle objects as rooms, walls and furniture and proposes a picking method to detect the object on which the user clicks, as demoed by openHAB.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator