PDA

View Full Version : executing command


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


global proc doThis1()
{
sphere;
}

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

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

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

Luddy
04-23-2003, 03: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;
SelectHierarchy;
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];
etc.....................


// Error: No object matches name //

gmask
04-23-2003, 04: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.

http://www.highend3d.com/files/dl.3d?group=melscripts&file_loc=HeirSearchReplace-v0.1-.mel&file_id=968

http://www.highend3d.com/files/dl.3d?group=melscripts&file_loc=cometRename-v1.2-.mel&file_id=2153

http://www.highend3d.com/files/dl.3d?group=melscripts&file_loc=jSearchReplace-v1.0-.mel&file_id=369

Luddy
04-24-2003, 05: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
break;
}

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

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

//etc...

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.