Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

set visibility/lightbulb of the Joints true/false

Message 1 of 3
429 Views, 2 Replies

set visibility/lightbulb of the Joints true/false

Hi all,

I tried to use an AddIn to show me all Joints and added to the Inputs a ButtonRowCommandInput with a Show/Hide button. Then I used the OnInputChangedHandler to toggle the visibility of the Joints and the Joints-folder to true or false, depending on wich button I pressed.

I put the code to set the isLightBulbOn and isVisible in a function, which gets called and executed as desired.

def set_visibility(boolVal):
    sets the Visibility of all Joints to the committed boolValue
    #print(boolVal)	#testing for debug
    app = adsk.core.Application.get()
    design = adsk.fusion.Design.cast(app.activeProduct)
    root = design.rootComponent

    des_Join = root.joints
    root.isJointsFolderLightBulbOn = boolVal
    allJoints = root.allJoints
    for joint in allJoints:
        joint.isLightBulbOn = boolVal
        joint.isVisible = boolVal


The result is that the lightbulb-icons of all Joints and the Joints-folder as programmed switch on or off, but switch back again, so effectively nothing changed.


Can anybody tell me where my fault is?


Labels (3)
Message 2 of 3
in reply to: Anonymous

Hi @Anonymous .


I tried creating a simple test script and I didn't notice any problems with the set_visibility function.


I've had experience with the InputChangedEvent being called multiple times when something changes.

How about setting up a breakpoint in InputChangedHandler to see if the set_visibility function is being called at a timing you are not expecting?

Message 3 of 3
in reply to: kandennti

I tried it with breakpoints, the handler is getting called right.

I solved the problem by using a function that handles the preview of the model. After using this function the model view gets refreshed when I press a button, and the visibility of the joints stay on/off.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators

Autodesk Design & Make Report