Notifications
Clear all

[Closed] Rename object to avoid duplicate name

I would like to avoid duplicate object name in scene
How to I rename it automatically? Just fix the duplicate name only
For example: there’s 3 object having same name: table
I could rename it to table_01,table_02, table_03
But I worry that there’s some object name table_01 or 02, 03
Could you guy tell me any ideas?

3 Replies
allName = for i in objects collect i.name -- collect all name first
  for j in selection where findItem allName i.name == 0 do ...rename it.....else not rename it or display message box ....

you could also using bsearch …search in maxscript …also regex apply too.

my problem is when I rename a duplicate name to another name, that name may same with other object


 name = uniqueName name
 

Maxscript has a built-in function to produce a unique name for something.

[i]
uniqueName[/i] <prefix> [[i]numDigits[/i]:<integer>]