MoI discussion forum
MoI discussion forum

Full Version: Auto Number Object Copys

Show messages:  1-20  21-23

From: Mindset (IGNITER)
27 Oct   [#21] In reply to [#5]
Hello Micheal, et. al.

Might there be some modification that would respect the 'order of selection' when using the "object name separator" script?
http://moi3d.com/forum/index.php?webtag=MOI&msg=3114.5

Thanks!

Moi Bueno
MindSet
From: Michael Gibson
27 Oct   [#22] In reply to [#21]
Hi MindSet,

re:
> Might there be some modification that would respect the 'order of selection' when using the "object name separator" script?

Try this one:

script:var Objects = moi.geometryDatabase.getObjects(); Objects.sortBySelectionOrder(); 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); } }

- Michael
From: Mindset (IGNITER)
28 Oct   [#23] In reply to [#22]
Terrificâť—
I left-padded the number with zeros to 2 digits Took me hours

script: /*!Obj-Name + Number */ var numb = 0 ; var Objects = moi.geometryDatabase.getObjects(); Objects.sortBySelectionOrder(); 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 ) { numb = (i+1); numb = numb.toString();while (numb.length < 2) numb = "0" + numb; Names[Name][i].name = Name + '_' + numb; } }


Moi Bueno
MindSet

Show messages:  1-20  21-23