Get features of model in a Inventor drawing view

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to get features of the model attached to a view in Inventor drawing (Inventor 2014)
I tried the following code and it is failing.
Private Sub GetFeaturesOfModelFromOccurence(oFrontView As DrawingView)
Try
' Get the assembly document that is attached to the view (assuming assembly model in the view)
Dim oDoc As AssemblyDocument
oDoc = InventorApplication.Documents.ItemByName(oFrontView.ReferencedDocumentDescriptor.FullDocumentName)
' Get all the components in the assembly uisng component definition
Dim compDef As AssemblyComponentDefinition
compDef = oDoc.ComponentDefinition
Dim compOccurences As ComponentOccurrences
compOccurences = compDef.Occurrences
Dim compOccurence As ComponentOccurrence
For Each compOccurence In compOccurences
' Get the Inventor Document assocaited with the component occurence
Dim partDoc As PartDocument
' The following statement fails - I think the argument ItemByName expects is FullDocumentName and I am passing Name
' How to get the document from component occurrence?
partDoc = InventorApplication.Documents.ItemByName(compOccurence.Name)
Dim partCompDef As PartComponentDefinition
partCompDef = partDoc.ComponentDefinition
Dim compPartFeatures As PartFeatures
compPartFeatures = partCompDef.Features
For Each feat As PartFeature In compFeatures
MessageBox.Show(" Feature name >" + feat.Name + "<")
Next
Next
Catch ex As Exception
MessageBox.Show("ERROR : " + ex.Message + System.Environment.NewLine)
MessageBox.Show(ERROR : " + ex.StackTrace + System.Environment.NewLine)
End Try
End Sub