Renaming Objects in a scene

So have this set up in maxscript to make max groups out of the names of the meshes but now that I got that done. I was wondering can I alter this to make it remove the names of the meshes. So instead of tg-00054-eucsidebuilding_101_low just be eucsidebuilding_101_low ?

group $'*tg-0000-*' name:"tg-0000-"
group $'*tg-0001-*' name:"tg-0001-"
group $'*tg-0002-*' name:"tg-0002-"
group $'*tg-0003-*' name:"tg-0003-"
group $'*tg-0004-*' name:"tg-0004-"
group $'*tg-0005-*' name:"tg-0005-"
group $'*tg-0006-*' name:"tg-0006-"
group $'*tg-0007-*' name:"tg-0007-"
group $'*tg-0008-*' name:"tg-0008-"
group $'*tg-0009-*' name:"tg-0009-"
group $'*tg-0010-*' name:"tg-0010-"
group $'*tg-0011-*' name:"tg-0011-"
group $'*tg-0012-*' name:"tg-0012-"
group $'*tg-0013-*' name:"tg-0013-"
group $'*tg-0014-*' name:"tg-0014-"
group $'*tg-0015-*' name:"tg-0015-"
group $'*tg-0016-*' name:"tg-0016-"
group $'*tg-0017-*' name:"tg-0017-"
group $'*tg-0018-*' name:"tg-0018-"
group $'*tg-0019-*' name:"tg-0019-"
group $'*tg-0020-*' name:"tg-0020-"
group $'*tg-0021-*' name:"tg-0021-"
group $'*tg-0022-*' name:"tg-0022-"
group $'*tg-0023-*' name:"tg-0023-"
group $'*tg-0024-*' name:"tg-0024-"
group $'*tg-0025-*' name:"tg-0025-"

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

...

Try this line

for i in $'tg*' do (i.name = substring i.name (findString i.name "e") -1)

barigazy

barigazy's picture

...

This will add unique name to the object

for i in $'tg*' do (i.name = uniquename (substring i.name (findString i.name "e") -1))

barigazy

TwilightZoney's picture

-- Error occurred in i loop;

-- Error occurred in i loop; filename: C:\Users\Twi\Desktop\; position: 58; line: 1
-- Frame:
-- i: $tg-0000-
-- Unable to convert: undefined to type: Integer

I get this I'm not sure how you want me to be using it.

barigazy's picture

...

You recive error because you are using "-" sign in your name. Never use mathematical sign in node names.

--This works
obj = $'tg-0000-eucsidebuilding_4_low'
-- this not
obj = $tg-0000-eucsidebuilding_4_low
-- So you better rename all objects
-- This concept is more appropriate
"tg_0000_eucsidebuilding_4_low"

Then my previous code works fine
U can use this tool for renaming scene nodes and much more
http://www.scriptspot.com/3ds-max/scripts/interactive-universal-renamer

barigazy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.