Turn On\Off LightBulb for root component

Turn On\Off LightBulb for root component

akonovalenko
Contributor Contributor
1,511 Views
6 Replies
Message 1 of 7

Turn On\Off LightBulb for root component

akonovalenko
Contributor
Contributor

Hello everyone!

Does anyone have an idea how to control model visibility from Python script?

As far as i understand, i need to use isLightBulbOn property of Occurrence object 
http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-203a9b47-df8f-4373-9535-b3df3d8e558f

 

But how to get access to the root component occurrence?

Thank you.

 
0 Likes
1,512 Views
6 Replies
Replies (6)
Message 2 of 7

kandennti
Mentor
Mentor
0 Likes
Message 3 of 7

akonovalenko
Contributor
Contributor

But Fusion360 itself allows to click on the root "light bulb" and control all model visibility.
Which mean that this functionality exist but the process to get access to it is not obvious

0 Likes
Message 4 of 7

kandennti
Mentor
Mentor

I think that not all the functions are provided by the API.

0 Likes
Message 5 of 7

goyals
Autodesk
Autodesk

One way to do that is write your own function and pass the fusionComponent to it. There are certain functions available on fusionComponent object and using them you can turn off things like origin, bodies, sketches etc but I agree it is not elegant. The reason behind providing visibility method on Occurrence is user might be interested to turn off only a particular instance of a component.

 

You can typecast the component to fusion component like this

 

fusionComponent= adsk.fusion.Component.cast(app.activeProduct.rootComponent)



Shyam Goyal
Sr. Software Dev. Manager
0 Likes
Message 6 of 7

akonovalenko
Contributor
Contributor

I don't wont to disable visibility on root component I would like to enable it. Since, without enabling it, changes in light bulbs at sublevels will have no effect, all components will remain invisible regardless of the status of their own  light bulbs

0 Likes
Message 7 of 7

goyals
Autodesk
Autodesk

May I know the scenario where root component visibility is turned off.



Shyam Goyal
Sr. Software Dev. Manager
0 Likes