All of my files have a coordinate system set up on the left and right side of modular items. I would like to write a macro to go down the tree of an assembly (top to bottom) selecting coordinate2 of component 1 and coordinate1 of component 2, then add a coincident mate. Then coordinate2 of component 2 and coodinate1 of component 3, then add a coincident mate. And so on all the way down the tree.
I have a variable for :
pathnoextension (assembly name) I already have this one figured out
boolstatus = Part.Extension.SelectByID2("Coordinate System2@" & firstselection & "@" & PathNoExtension, "COORDSYS", 0, 0, 0, False, 1, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Coordinate System1@" & secondselection & "@" & PathNoExtension, "COORDSYS", 0, 0, 0, True, 1, Nothing, 0)
Dim swMate As Mate2
Set swMate = Part.AddMate5(20, -1, False, 0.124990244006958, 0.001, 0.001, 0.001, 0.001, 0, 0, 0, False, False, 0, longstatus)
How do I traverse down the tree to get the name of the 1st component in the tree then get the name of the 2nd component? So I can execute the mate as shown above. And on down the list 2nd component, 3rd component - mate. 3rd component, 4th component - mate. etc.
Any help is appreciated. Thanks - Eric