@christian_horstGMMED. Renaming all assembly components in a large assembly can be a lot more complex than you might expect, because no two component occurrences can have exactly the same name, which is why they automatically put the ":" character, followed by an index Integer, at the end of every occurrence name in the model browser. So, if your assembly has more than one occurrence in it that is referencing the same source model document file, or another one with the same Part Number value, then the simplistic code example above will not work, because it will be trying to name all occurrences with the same part number value the same. Attached is a text file containing some code for a far more complex and intuitive iLogic rule example, with error avoidance measures and feedback built into it, for a task like this. I already had a similar code in my custom snippets from another case at some point, so I just updated it a bit. The code is broken up into 3 routines. The 'Main' routine gets the assembly document, attempts to group all of its components by their Part Number values with a second routine, then uses the third routine to try to rename all of them by their Part Numbers, with an Index system applied, per Part Number group. Although its second routine is set-up to 'Optionally' work recursively, its actions should not effect any of the assembly's referenced documents, just the names of the occurrences, as seen in the model browser tree from the perspective of the main assembly. And its actions should be easy to undo with a single click on the undo button. So, if the simplistic example above does not work for you, you can give this one a try. I have not tested it yet, so you may want to review its contents first, then test on unimportant files first.
Wesley Crihfield

(Not an Autodesk Employee)