Auto Number Object Copys
 1-20  21-23

Previous
Next
 From:  Mindset (IGNITER)
3114.21 In reply to 3114.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

EDITED: 27 Oct 2024 by IGNITER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
3114.22 In reply to 3114.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
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Mindset (IGNITER)
3114.23 In reply to 3114.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

EDITED: 28 Oct 2024 by IGNITER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages:  1-20  21-23