adizanni / ExportToHASS

Sweethome3D Plugin for Home Assistant Export
GNU General Public License v3.0
49 stars 5 forks source link

Several instances of each object exported #13

Open pierre-nedelec opened 11 months ago

pierre-nedelec commented 11 months ago

Hi @adizanni ! thanks for your awesome work on this and the floor3d home assistant card. I have an issue when exporting from SweetHome3D with this: the obj and json contain several instances of each object in the layout, which leads to issues down the way (example: activating light is super hard because when you click on it it could be any of the instances...).

Have you encountered this before?

Example image ```json { "wall_0_1" : { "object_id": "wall_0_1" }, "wall_0_2" : { "object_id": "wall_0_2" }, "wall_0_3" : { "object_id": "wall_0_3" }, "wall_0_4" : { "object_id": "wall_0_4" }, "wall_0_5" : { "object_id": "wall_0_5" }, "wall_0_6" : { "object_id": "wall_0_6" }, "wall_1_1" : { "object_id": "wall_1_1" }, "wall_1_2" : { "object_id": "wall_1_2" }, "wall_1_3" : { "object_id": "wall_1_3" }, "wall_1_4" : { "object_id": "wall_1_4" }, "wall_1_5" : { "object_id": "wall_1_5" }, "wall_1_6" : { "object_id": "wall_1_6" }, "wall_2_1" : { "object_id": "wall_2_1" }, "wall_2_2" : { "object_id": "wall_2_2" }, "wall_2_3" : { "object_id": "wall_2_3" }, "wall_2_4" : { "object_id": "wall_2_4" }, "wall_2_5" : { "object_id": "wall_2_5" }, "wall_2_6" : { "object_id": "wall_2_6" }, "wall_3_1" : { "object_id": "wall_3_1" }, "wall_3_2" : { "object_id": "wall_3_2" }, "wall_3_3" : { "object_id": "wall_3_3" }, "wall_3_4" : { "object_id": "wall_3_4" }, "wall_3_5" : { "object_id": "wall_3_5" }, "wall_3_6" : { "object_id": "wall_3_6" }, "room_0_1" : { "object_id": "room_0_1" }, "Floor_uplight_1" : { "object_id": "Floor_uplight_1" }, "Floor_uplight_2" : { "object_id": "Floor_uplight_2" }, "Floor_uplight_3" : { "object_id": "Floor_uplight_3" }, "Floor_uplight_4" : { "object_id": "Floor_uplight_4" }, "Floor_uplight_5" : { "object_id": "Floor_uplight_5" }, "Floor_uplight_6" : { "object_id": "Floor_uplight_6" }, "Floor_uplight_7" : { "object_id": "Floor_uplight_7" }, "Wall_uplight_1" : { "object_id": "Wall_uplight_1" }, "Wall_uplight_2" : { "object_id": "Wall_uplight_2" }, "Wall_uplight_3" : { "object_id": "Wall_uplight_3" }, "Wall_uplight_4" : { "object_id": "Wall_uplight_4" }, "Wall_uplight_5" : { "object_id": "Wall_uplight_5" } } ``` Part of the `.obj` file: ``` g Floor_uplight_4 usemtl flltgrey v 324.0 180.97499 62.570183 v 319.30157 180.97499 61.936256 ... g Floor_uplight_5 usemtl flltgrey v 312.26242 178.92667 42.04767 v 328.0125 178.92667 34.3226 ... g Floor_uplight_6 usemtl dkgrey v 337.82834 0.0 43.309513 v 338.0993 0.0 46.06018 ```
adizanni commented 11 months ago

Hello @pierre-nedelec , in reality what you see in the export it is not the same object but the components of the objects (for a lamp it can be the base, the cover, etc.). If you want an object to group together all the components with a unique name you just append a '#' to the end of the object name in SweetHome. Try and let me know if it fits your needs