View Full Version : executing command

04-23-2003, 02:24 AM
I'm trying to execute doThis1; by printing $hhh. Is there another way to script this?

global proc doThis1()

$hhh = `doThis1`; // I don't want it to execute here
print $hhh;

04-23-2003, 02:31 AM
What is that you are trying to do?

You don't have to use the print command to execute your procedure.

04-23-2003, 02:53 AM
I think I'm complicating things. I was trying to put the variables in a break statement in a loop based on the number of joints. I'm trying to rename spine joints by selecting the top parent joint. I can use this method but I get an error unless exactly 7 joints are created. How do I write the loop? I want to start by selecting the top joint and then rename them automatically without an error.

string $firSel[] = `ls -sl`;
select $firSel;
print $firSel;
select -d $firSel;
string $hirSelected[] = `ls -sl`;

int $numElements = size( $hirSelected );
print $numElements;

string $letUnd[8] = { "spineA", "spineB", "spineC", "spineD", "spineE", "spineF", "spineG", "spineH" };

print $letUnd[4];

rename $firSel $letUnd[0];

print $hirSelected[0];

rename $hirSelected[0] $letUnd[1];
rename $hirSelected[1] $letUnd[2];
rename $hirSelected[2] $letUnd[3];
rename $hirSelected[3] $letUnd[4];
rename $hirSelected[4] $letUnd[5];
rename $hirSelected[5] $letUnd[6];
rename $hirSelected[6] $letUnd[7];
rename $hirSelected[7] $letUnd[8];
rename $hirSelected[8] $letUnd[9];

// Error: No object matches name //

04-23-2003, 03:30 AM
Well this kind of renaming hierarchy script has been done before but the best ting to do is to rename the lowest node first and then work your way up so that the paths to the nodes do esnot changes as you go down.

04-24-2003, 04:40 PM
Ok, I finally figured it out after 4 hours of learning how loops work.

Simple enough. :insane:

while ( $numElements > 0 )
rename $hirSelected[0] $letUnd[1]; //B

while ( $numElements > 1 )
rename $hirSelected[1] $letUnd[2]; //C

while ( $numElements > 2 )
rename $hirSelected[2] $letUnd[3]; //D


CGTalk Moderation
01-15-2006, 12:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.