AnsweredAssumed Answered

Is it possible to use a macro to rename all of the mates in an assembly?

Question asked by Brian Guth on Apr 5, 2018
Latest reply on Apr 8, 2018 by Deepak Gupta

I have an assembly with hundreds of varying mates.  As you would expect, they are not all grouped together by "coincident", "concentric", etc.  I am looking to find a macro that would start at the beginning of the Mates Folder and systematically proceed down the list -- renumbering them sequentially.  I do not want to change the name of the "type" of mate, just the number associated with it.


The justification for this macro is to deal with the unwieldy numbers that have become attached to the existing mating conditions.  We have mates with names like "Concentric54872" that have been generated by some past in-house employees and outsourced vendors.


E.g.  If there's a "Coincident124" and then the next coincident is "Coincident152" and then the next coincident is "Coincident177" etc.  I would like them to be renumbered to "Coincident124", "Coincident125", "Coincident126", etc.


Since the types of mates aren't all grouped together -- the macro would need to be intelligent enough to remember the number of the last instance and add a +1 increment.  Has anyone ever attempted this?


I have attempted to record a macro addressing this task, but upon inspection of the code, nothing relevant shows up.  I have investigated the "IMate2" and "IMateReference" interfaces in the API'; but have been met with little actionable success.


I would be most grateful to anyone who would be willing to take on this challenge.