How to check if an entity is Derived from a specific 'parent' class

How to check if an entity is Derived from a specific 'parent' class

scottmoyse
Mentor Mentor
535 Views
1 Reply
Message 1 of 2

How to check if an entity is Derived from a specific 'parent' class

scottmoyse
Mentor
Mentor

So I can check this:

 

 

 

if entityToFind.objectType != adsk.fusion.Sketch.classType():

 

 

 

Which will allow the program to drop into the if condition if the object isn't of the Sketch type.

But what I want is to check to see if the entity selected is a sketch object of any kind... So I can do this:

 

 

 

if entityToFind.objectType != adsk.fusion.SketchCurves.classType():

 

 

 

but the thing is I haven't found a case where a selected entity is in fact a Sketch Curve... it's always a Sketch Line or Sketch Circle etc etc. 

 

How can I check of the selected entity is derived from the SketchCurves Class?

 

Really I want to go as far as finding out if the selected entity is any form of sketch entity.


Scott Moyse
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature


RevOps Strategy Manager at Toolpath. New Zealand based.

Co-founder of the Grumpy Sloth full aluminium billet mechanical keyboard project

0 Likes
Accepted solutions (1)
536 Views
1 Reply
Reply (1)
Message 2 of 2

scottmoyse
Mentor
Mentor
Accepted solution

I used this in the end. It worked perfectly:

if adsk.fusion.SketchEntity.cast(entityToFind):

Scott Moyse
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature


RevOps Strategy Manager at Toolpath. New Zealand based.

Co-founder of the Grumpy Sloth full aluminium billet mechanical keyboard project