Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic code to check if part feature is supressed from drawing

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
J_Dumont
139 Views, 2 Replies

iLogic code to check if part feature is supressed from drawing

Hello,

I have iLogic code to create the necessary dimensions in my drawing views. However, I need to determine if a feature is suppressed and, if so, skip creating dimensions.

 

I captured the model name as shown below.

 

ActiveSheet = ThisDrawing.Sheet("UPPER SM PAN:18")
Dim modelName = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)

I want to check the file to see if certain features are suppressed.

 

Labels (3)
2 REPLIES 2
Message 2 of 3
A.Acheson
in reply to: J_Dumont

Hi @J_Dumont 

You will need to use the inventor API for this. From the model document you will need to declare as a partcomponentdefinition, then traverse PartFeatures

 

PartComponentDefinition.Features()

As PartFeatures

 

Then check each Partfeature for being suppressed

 

PartFeature.Suppressed() As Boolean

Here is a sample.

 

Dim partDoc as PartDocument = ThisDrawing.ModelDocument
Dim partDef as PartComponentDefinition = partDoc.ComponentDefinition
For each feat as PartFeature in partDef.Features
     If feat.Name = "xyz" AndAlso feat.Suppressed = True Then
           'DO SOMETHING
     End If 
Next

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 3
J_Dumont
in reply to: A.Acheson

Hi @A.Acheson 

Thanks for the help.

 

I was able to get what I needed using the code shown below.

 

Dim Sheet_18 = ThisDrawing.Sheets.ItemByName("UPPER SM PAN:18")
Dim FrontView = Sheet_18.DrawingViews.ItemByName("FrontView")
Dim modelDoc = FrontView.ModelDocument
Dim modelObjects = StandardObjectFactory.Create(modelDoc)
If modelObjects.Feature.IsActive(modelDoc, "Notch Cut Out")
	AddNotchForAnchor = True
	Else
	AddNotchForAnchor = False
End If

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report