Light bulb v.s. Visible

Light bulb v.s. Visible

j.han97
Advocate Advocate
614 Views
4 Replies
Message 1 of 5

Light bulb v.s. Visible

j.han97
Advocate
Advocate

Hi all,

 

What is the difference between isLightBulbOn and isVisible? I have tried both of them on a body under root component and it seems like they do exactly the same thing.

 

Can somebody explain the difference(s)?

 

Thank you so much in advance.

 

0 Likes
Accepted solutions (2)
615 Views
4 Replies
Replies (4)
Message 2 of 5

BrianEkins
Mentor
Mentor
Accepted solution

It's possible that isLightBulbOn can return True and isVisible will return False.  The isLightBulbOn gets and sets whether the eye (which used to be a light bulb) is turned on or not.  The isVisible indicates the current visibility state of the body.  The browser below illustrates a case where isLightBulbOn is True but isVisible is False because the body is set to display but the light bulb for its parent component is off, which turns off the visibility of everything in the component.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 5

j.han97
Advocate
Advocate

Hi @BrianEkins,

 

For my understanding, isVisible represents the actual state of the visibility of the object (body/occurrence), while isLightBulbOn might not. In a more direct way, if isVisible is True, the object must be visible. If isLightBulbOn is True, the object might not be visible.

 

Is this statement correct?

 

I have several questions in mind but I guess I can just experiment with it myself. Just one question I would like to ask: Is there any case/exception where setting these properties will fail? For example, when parent component has isVisible as False and I try to let one of its bodies to have isVisible = True.

 

Thank you very much.

0 Likes
Message 4 of 5

BrianEkins
Mentor
Mentor
Accepted solution

I would have to experiment to see what the behavior is when setting the isVisible property.  I know that originally, the BrepBody object only had the isVisible property and later the isLightBulbOn was added when it was recognized there is different behavior and it wasn't possible to get the current visibility state.  Because the isVisible property existed as a read-write property, changing it to read-only would break existing programs.  I just did a test and setting the isVisible property is the equivalent of setting the isLightBulbOn but getting it always returns the current state.  This means there are cases where you can set it to True but when you get it it will return False.  It's best to consider IsVisible as read-only and use IsLightBulbOn to change the visibilty.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 5 of 5

j.han97
Advocate
Advocate

I see. Based on what I found in my testing and the information from Brian:

 

1. In many situations, isVisible property cannot be set (return error). Hence, it is best to be used as a read only property.

 

2. I can set a child occurrence's isLightBulbOn property to TRUE when its parent occurrence's isLightBulbOn property is FALSE. However, this will not change anything, i.e., the child occurrence is still not visible, and the value of child occurrence's isLightBulbOn property remains to be FALSE.

This means that in order to show a hidden object, one has to check the isLightBulbOn property of its paths (parent, parent of parent, etc) as well.

 

Thank you @BrianEkins for your help.

 

0 Likes