Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
matt_jlt
in reply to: donaldleigh

Try this

 

' Check document is a part / a document is open
If ThisApplication.Documents.VisibleDocuments.Count = 0 Or ThisApplication.ActiveEditDocument.DocumentType <> Inventor.DocumentTypeEnum.kPartDocumentObject Then
	MessageBox.Show("A part document must be open")
End If

' Get active part document
Dim oDoc As Inventor.PartDocument = ThisApplication.ActiveDocument

' Get part component definition
Dim oCompDef As Inventor.PartComponentDefinition = oDoc.ComponentDefinition

' Check there are features before accessing them
If oCompDef.Features.Count = 0 Then
	MessageBox.Show("There are no features in this part")
End If

' Check the first feature type
Select Case oCompDef.Features(1).Type ' Collection is not zero based so use 1 to get the first item
	Case Inventor.ObjectTypeEnum.kExtrudeFeatureObject
		MessageBox.Show("Extrude Feature")
		' Run extrude rule
		'iLogicVb.RunRule("ruleName")
	Case Inventor.ObjectTypeEnum.kSweepFeatureObject
		MessageBox.Show("Sweep Feature")	
		' Run sweep rile
		'iLogicVb.RunRule("ruleName")

End Select