Is there such a macro - rename part files by adding prefix.

Does anyone know of a Macro that will do the following either in SolidWorks or PDMWorks. Also willing to pay someone to write one.

I have inherited number of files with a descriptive filename, I wish to add an alphanumeric prefix (that automatically increments sequentially) to all the part files within a given subassembly.

e.g. With the main assembly and a specific subassembly open rename part files as below.

Main Assembly

---Subassembly one

------Partfiles (add Prefix to all part files in this subassembly beginning with CW06-10-2001 incrementing sequentially)

---Subassembly two

------Partfiles (add Prefix to all part files in this subassembly beginning with CW06-10-5001 incrementing sequentially) etc

John Layne

formatting link

Reply to
John Layne
Loading thread data ...

I think this program can help you. Oscar's Renamer...Just Google it. Will show you a folder as text file which you can copy it in a text editor with find/replace feauteres, and when you are done just copy back and you are done...

Oz

"John Layne"

Reply to
yozotrinity

If I did this the SolidWorks assembly would no longer no know where to look for the files.

Thanks for the suggestion.

John Layne

formatting link

Reply to
John Layne

Can you provide more information on your situation and what you need done? There are several important questions you need to answer.

As you describe what you want I see a number of potential conflicts.

  1. What if an assembly contains multiple instances of the same part? You would need a macro smart enough to know when it reached a duplicate instance and to not rename it.

Are you changing multiple top-level assemblies?

  1. If so do any of them share common parts/subassemblies? If so how do you resolve naming conflicts between those two?

If you just have a few unique subassemblies containing unique parts then updating would be easy. You write a macro that checks to make certain Tools -> Options -> System Options Tab -> External References

-> Update Component Names when documents are replaced is UNChecked. Then have a macro iterate through all subassemblies and parts and rename them according to your schema. However if you have either of the scenarios outlined above then it gets more complicated. For question 1 you could put in a check to see if the component name already contains your prefix. If so then ignore changing it. For question 2 you could probably use PDM/Works auto-update other referenced assemblies and also use the solution from question 1 to make sure you don't stomp on the naming schema.

You can use the Component2::Name2 API to rename your documents according to your needs. I have some code for iterating through assembly components if you need it.

Mr. Who

Reply to
Mr. Who

Thanks for your valuable input, someone is currently writing a Macro for me I'll pass along your well thought through comments.

John Layne

formatting link

Reply to
John Layne

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.