VBA find part in assembly occuring multiple times

VBA find part in assembly occuring multiple times

Anonymous
Not applicable
335 Views
0 Replies
Message 1 of 1

VBA find part in assembly occuring multiple times

Anonymous
Not applicable

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?

0 Likes
336 Views
0 Replies
Replies (0)