Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Register Log in

Recursive Macros

bhayden

New member
Is there a way for a macro to call it's self to create a repeating loop. The application I'm thinking of is Restructure. It seems totally lame that you have to start completely over for every component you want to move. Of am I missing something? Is it possible to select a set of components and move them to a subassembly?



Bernie Hayden

XKL LLC
 

Brian_Adkins

Moderator
I'm not sure Restructure was meant for mass moving of components from one assembly to another in the assembly hierarchy... Keep in mind that as components are relocated from Assy-A to Assy-B, that the assy-constraints for that component still reference geoemtry from Assy-A. You are, in fact building layers of external references from Assy-A, through the Top-Level Assembly and finally into Assy-B.



This can create very nasty situations later when you may want to open or check-out just Assy-B, but of course Assy-A and the Top-Level Assembly are required for it to regenerate.



As a matter of practice, I always 'package' any component before I restructure it. Then I either re-create the constraints in the new assembly, or use the 'fix' constraint. That way there is no external reference baggage brought along for the ride.



If you need to move a bunch of related components from one assy to another, consider creating a UDF consisting of all these components and then applying that UDF to the target assembly... This method works pretty well as long as there were few assembly references required to assemble the components into the source assy (other than any references they have to each other - which will not be required for UDF creation).



-Brian
 

bhayden

New member
Brian,



You are right on about the danger of creating external references (been there, done that :+) . You have some good suggestions on how to avoid the problem. Personally I've never really been able to grasp the UDF functionality very well.



Sometimes though it's restructure that is really what needs to be done. I usually come across this situation when an assembly is reused as the basis for a new project or an existing design is converted into a family table of related products.



While this was the example that came to mind I think there are other areas where a recursive macro would be just the ticket.



-Bernie-
 

Sponsor

Top