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.
- 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?
- 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.