Jump to content
3D Coat Forums
Sign in to follow this  
AntonTenitsky

Improving batch renaming script

Recommended Posts

Hi all,

I'm pretty dumb scripter but I had a huge need in the renaming of 100+ layers so I came up with this:

void main() {


    Vox  v;
        
    string x = GetCurVolume();

     v.firstForRoot().rename(x);
     for ( int i = 0; i < v.count(); ++i ) {
        v.at( i ).rename( x + i ).parent();
        Wait( 100 );
    }
}
 

It works but I don't know how to add intelligent zero padding to numbers like "003, 013, 334" I would be glad if we could improve this script.

Cheers,

Anton

 

  • Like 1

Share this post


Link to post
Share on other sites

Alright, I decided to add if else loops because I couldn't wait for an answer.

I don't know how to make it rename inside parent layers so atm you have to select each one of the parents to continue renaming them.

Also, you have to hide parent layers higher in the stack and only have visible one for renaming. Sigh... Hopefully, somebody more knowledgeable could make it a more versatile script

void main() {


    Vox  v;
        
    string x = GetCurVolume();
    SelectFirstVolume(true);
     v.rename(x);
     for ( int i = 0; i < v.count(); ++i ) {
        if (i < 10) { 
    v.at( i ).rename( x + "_00" + i ).parent();
            }
    else if ( i > 9){
    v.at( i ).rename( x + "_0"  + i ).parent();
    }
    else if ( i > 99){
    v.at( i ).rename( x + "_" + i ).parent();
    }
    
    }
}
 

Edited by AntonTenitsky
  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×