rjay. I managed to take your suggestion and with the help of google turn it into what i needed. I havent included what im doing with the objects now i have them but this will get anyone access to the containing view & the component occurence that is selected within that view.
From there you can access the referenced assembly of that view.
'Varibales needed for process the selected component and view.
Dim oView As DrawingView
Dim oSelectedObj As Object
Dim oGenObj As GenericObject
'Varibles needed for the referenced assembly document
Dim oRefAssy As AssemblyDocument
Dim oRefAssyOcc As ComponentOccurrence
Dim i As Integer
Dim Response As VbMsgBoxResult
'Get a hook to the document.
Dim oDoc As Inventor.DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
'Test to see if its a drawing.
If oDoc.DocumentType <> kDrawingDocumentObject Then
Exit Sub
End If
'Test to see the user has activated part priority.
If oDoc.SelectionPriority <> kPartSelectionPriority Then
MsgBox "You must select PartPriority.", vbInformation
Exit Sub
End If
'Test to see if the user has selected a component occurrence. This is a weak test as it cant be known if its a componentoccurrence
'until after the view is processed. If they select anything other than a assembly's child part it will error.
If oDoc.SelectSet.Count <> 0 Then
On Error GoTo NotAComponentOcc:
Set oGenObj = oDoc.SelectSet(1)
Call oDoc.ProcessViewSelection(oGenObj, oView, oSelectedObj)
'Reset error trapping
On Error GoTo 0
End If
'Find reference assembly file.
On Error GoTo NothingSelected:
Set oRefAssy = oView.ReferencedDocumentDescriptor.ReferencedDocument
'Reset error trapping
On Error GoTo 0
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro