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: 

Hide and show sketches

Message 1 of 5
1005 Views, 4 Replies

Hide and show sketches

Is there a function to hide and show a sketch by code?

I found a method on occurrences and BRepBodies named islightbulbon which does exactly what I want for those to types of objects, so I wondered why I couldn't find it for sketch. I mean, their structure seems pretty much the same when it comes to hiding and showing them.


Am I just blind or is it not there?


- Erik

Message 2 of 5
in reply to: erik



You can try sketch.isVisible to hide/show a sketch.

Zhongyang Chen
Fusion 360 API Developer
Message 3 of 5
in reply to: zhongyang.chenK3XZJ

Thank you, I thought it was a read-only property.


But I must say that this is the most inconsistent naming I have seen in Fusion. No offense.


Occurrence.isVisible is a read-only property.

Occurrence.isLightBulbOn is a read/write property.

Sketch.isVisible is a read/write property.


I get that there is a difference in being visible and having the light bulb turned on but it applies to both sketches, bodies and components. I don't see a reason why there should be a difference in the way they work.


And it is odd, that the API for Sketch.isVisible reads: "Indicates if this sketch is visible or not. Sketches that are not visible are ignored in profile calculations".

Only when one follows the link one will find that it is a read/write property.

Every time I find a read/write property in the Fusion API it sais "Gets and sets...".


- Erik

Message 4 of 5
in reply to: erik

You're right that it is inconsistent.  The sketch design should be the same as the others.  I've logged it in our tracking system and will look at what needs to be done.  The most obvious thing is to add an isLightBulbOn property but the trick will be to not change the behavior of the isVisible property so we don't break any existing programs.  


Thanks for pointing out the problem.

Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 5 of 5
in reply to: ekinsb

I am happy to hear that I am not the only one finding it inconsistent.

I understand your concern about changing sketch to match components setup, but that would break the program I just wrote.


This is a tough decision to make but can you change it and then just try to spread the word as much as possible?

Thinking of future developers using these properties, they would probably run into the same problem.


If you dont change it to be a read-only property will you change the API in Sketch.isVisible to read something like: "Gets or sets if the Sketch is visible..."


- Erik

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

Post to forums  

Autodesk DevCon in Munich May 28-29th

Autodesk Design & Make Report