Notifications
Clear all

[Closed] Incremental rename

I’m trying to write a simple script where I rename objects two ways.

  1. with a uniquename without suffix
  2. with a uniquename including suffix

I assumed that if you use (e.g. “board05”) as a base name and then use uniquename it would start at board05, board06, board07 etc etc but somehow my script starts at 01 every single time.

Also, if I include a suffix (e.g. “XY”), uniquename will not work incrementally at all. e.g using “board05” as the basename the new items will all be named “board01XY”, “board01XY”, “board01XY” etc

These are the lines im using:

(
for i in selection do i.name = uniquename base_name.text 
)

and

(
for i in selection do i.name = uniquename base_name.text +"XY"
)

If anyone can point me in the right direction I would appreciate it.

2 Replies

You would need to split the number out from your base_name.text, then re-concatenate the name with the suffix in between, i.e., split it so the “board” is a variable named “base”, the number is in a variable, say “nameNum” and then you have the suffix already captured. Then you concatenate the name by assigning them in the sequence you want. Or, do what is already on the built in Max renamer and have the number as a separate field, including an option of which number to start at so you already have the data split out from the beginning.

doh! I appreciate you giving a full explanation first and then just make me realize in the last part that max already has a renamer lol. im such a tard. Thank you.