Auto Number Object Copys

 From:  Michael Gibson
3114.5 In reply to 3114.3 
Hi Steve, here is an "object name separator" script that may be useful if that other option does not help:

script:var Objects = moi.geometryDatabase.getObjects(); var Names = new Object(); for ( var i = 0; i < Objects.length; ++i ) { var Obj = Objects.item(i); if ( Obj.name == '' ) { continue; } if ( !Names[Obj.name] ) { Names[Obj.name] = new Array(); } Names[Obj.name].push( Obj ); } for ( var Name in Names ) { if ( Names[Name].length == 1 ) { continue; } for ( var i = 0; i < Names[Name].length; ++i ) { Names[Name][i].name = Name + '_' + (i+1); } }


Copy that whole thing above and paste it in as the Command part of a new shortcut key under Options> Shortcut keys.

That will add numbers to the names of any duplicate objects.

It just sticks numbers at the end of the name though, so for example if you have 5 objects all named "Blah", after you run the script you will instead have Blah_1, Blah_2, Blah_3, Blah_4, Blah_5. So don't put the number into the original name, the script will add the numbers.


This method should work to separate the names no matter how you duplicated the objects, whether it was by array, copy/paste, importing another file, transform/copy, rotate with copy option, Ctrl+drag, whatever...

- Michael