AnsweredAssumed Answered

Macro to rename master model and keep references to child parts

Question asked by Sean Fearon on Jul 29, 2020
Latest reply on Jul 30, 2020 by Fifi Riri

I am writing a macro that copies over a master model and its folder structure which contains the child part files, and renames the parts/drawings based on a size change. (the "size" is in the title of each part and drawing)

 

I have got the part where it copies over the folder structure and solidworks documents working well. 

 

I am having trouble renaming the solid works parts and drawings without breaking references to the children parts. 

 

For context the master model is a multi-body .SLDPRT file where I am using the Insert->Features->Save Bodies feature to save out the individual bodies into their own part files to make drawings off of. What I have done in the past to fix this is use the solid works rename function in the file explorer window. but this is very time consuming as I have to start with the master model, then do every drawing, and then every part. I was hoping I could incorporate this functionality into the macro and have it loop through the file structure. 

 

The problem I am running into is most of the "find references" or "rename" methods are built around assemblies with parts in them, not multi body parts. If anyone has advice on a method to use or a chunk of code that is useful for this the help would be very appreciated!

Outcomes