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: 4
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 235 times and has 3 replies Next Thread
slikrik98
Newbie




Joined: Nov 7, 2023
Post Count: 2
Status: Offline
Reply to this Post  Reply with Quote 
How to obtain the ID of a light source

I need to know the object ID for incandescent light sources in my model, but it's not clear to me how to know what these IDs are. For other objects, when I look at the .obj file, I can search for specific text (like "Seat") and usually find object IDs that way. But it appears that my light sources are being given numeric IDs -- is there a way I can force a specific ID or know what the mapping is?
[Nov 7, 2023, 9:18:39 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: 9182
Status: Offline
Reply to this Post  Reply with Quote 
Re: How to obtain the ID of a light source

What ID are you talking about? The ID associated to each home object and defined in HomeObject super class or the catalog ID of furniture found also in HomePieceOfFurniture instances?
Both can be found in Home.xml entry found in a SH3D file (based on ZIP format). There’s no method to change the ID of an existing home object, but feel free to edit Home.xml entry to change them. Just be sure to keep they are unique.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Nov 7, 2023, 10:12:12 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
slikrik98
Newbie




Joined: Nov 7, 2023
Post Count: 2
Status: Offline
Reply to this Post  Reply with Quote 
Re: How to obtain the ID of a light source

If I open my home.obj file, I see lines that begin with 'g' and have some unique identifier after them. i.e.:

g Seat_897
usemtl fltan


I don't know where or how "Seat_897" is created/found, and in fact my home.xml file does not contain the word "seat" in it at all.

I found my incandescent light source in the XML file you pointed me to, but nowhere do I see any ID (other than its guid).

If you're wondering why I care about this -- I have an application (Home Assistant) that imports my .obj files and allows me to couple devices in my home to objects in my scene. For instance, I can tie a smart lightbulb to a lamp in my 3D scene and whenever I turn on my light, the scene renders with the lamp on, etc.

But I need to know the ID -- or what Home Assistant is referring to as the ID, the "g" line above -- of the light source in question to create this coupling.
[Nov 8, 2023, 12:48:48 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: 9182
Status: Offline
Reply to this Post  Reply with Quote 
Re: How to obtain the ID of a light source

As light sources are not exported in OBJ file, you won't find them without a trick.
If you want them in the exported OBJ file, you'll have to change the "original ID" of light sources in the OBJ file where they were defined. If you look in your SH3D file with a ZIP tool, you'll find some numbered files and one of them is a file at OBJ format containing the text g sweethome3d_light_source (to find it more easily, move the light sources at the beginning or the end of furniture list, and study the first or last numbered files).
Remove the prefix sweethome3d_ in that text, remove the entry named ContentDigests in the SH3D file and save the SH3D file (you may change temporarily the .sh3d extension to .zip if needed). Then if you open your file in Sweet Home 3D, light sources will always be displayed and exported to OBJ format (but they will also appear in renderings).
The file attached to this message shows what result you'll get (the OBJ file of the light source is stored in the ZIP entry named 7).
----------------------------------------
Attachment AlwaysVisibleLightSources.sh3d (55770 bytes) (Download count: 16) (Always visible light sources)

----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Nov 8, 2023, 10:07:33 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ 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 2006-2024 eTeks - All rights reserved