02-25-2021
10:19 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
02-25-2021
10:19 PM
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