- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Greetings,
I have an open assembly ("AssemblyTop"). In this assembly I have another assembly ("AssemblyMid"), and within that assembly I have several Occurrences of parts and assemblys ("AssemblyLowest" and "PartLowest").
I want to loop and get the ParentOccurrence.name of all of my "Lowest" Components, but I only get an error when I get to the "Debug.print oSubOcc.ParentOccurrence.Name" -part.
Am I missing something or is there something wrong in the API?
Code posted below.
Sub TestSubSubParentName()
Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oOcc As ComponentOccurrence
For Each oOcc In oDoc.ComponentDefinition.Occurrences
If oOcc.DefinitionDocumentType = kAssemblyDocumentObject Then
Dim oSubAsm As AssemblyDocument
Set oSubAsm = oOcc.Definition.Document
Dim oSubOcc As ComponentOccurrence
For Each oSubOcc In oSubAsm.ComponentDefinition.Occurrences
Debug.Print oSubOcc.ParentOccurrence.Name 'This is where my code breaks for unknown reasons...
Next
End If
Next
End Sub
Thanks in advance.
Solved! Go to Solution.