VBA find part in assembly occuring multiple times

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm writing some code to find information about parts in an assembly, however am getting stuck when the same part is placed multiple times in the same assembly. Using:
For Each doc In asmDoc.AllReferencedDocuments
If doc.DocumentType = kPartDocumentObject Then
Set PartDoc = doc
Set PartDef = PartDoc.ComponentDefinition
etc..
I can find the relevant information on the features and position and can transform the position of the features within the part so I get the position within the whole assembly. If the part occurs more than once I need to find all of the relevant transformations. So far I have this to find them:
Set PartOccur = asmDoc.ComponentDefinition.Occurrences.AllLeafOccurrences.Item(i + 1)
Set MatTrans = PartOccur.Transformation
This works when there are no repeated parts.
Does anyone have any idea how to do this?