PDA

View Full Version : curve along a joint chain


sauzer
05-03-2006, 02:42 AM
I need to create a script that makes an EP curve with degree 1 that has a cv exactly over every joint of a given joint chain.

So basically I would create a joint chain with, for example, 20 joints, then select the root of the chain, run the script and the result would be a EP curve of degree 1 with 20 cvs over every joint in the chain.

My approach so far is creating a loop; every iteration adds the value of the coordinates of a joint to the string "-p" which is the flag for the "position" of the cv. so at the end of the loop I have a string that looks something like this

"-p 2 3 4 -p 5 6 7 ...."

I finally run the curve command replacing the "-p ..." part of the command with my string.

The error message I get is "No object matches name".

Can anyone tell me if there is a simpler way to do this?

Thanks

Segmoria
05-03-2006, 06:31 PM
Well your workaround seems like it should do the job, I can't think of a different more direct and efficient approach to it at the moment.

I cannot possibly predict what is causing your error, but from the message I would say that it is probably a syntax error, maybe forgetting to declare a flag or hardcoding the name of the joints?
Also have you added a semicolon at the end of the string before evaluating?

You should post your script if you want more precise help

neonoodle
05-03-2006, 08:18 PM
I did the same thing,
here's the function:

// makeCurveAlongJointChain
//
// makes a curve along the joint chain
global proc string makeCurveAlongJointChain(string $root)
{
select -hi $root;
string $joints[] = `ls -sl -type joint`;
int $numObjs = `size($joints)`;

float $pos[] = `joint -q -p $joints[0]`;
string $curveName = `curve -d 1 -p $pos[0] $pos[1] $pos[2]`;

for($i = 1; $i < $numObjs; $i++) {
float $pos[] = `joint -q -p $joints[$i]`;
curve -a -p $pos[0] $pos[1] $pos[2] $curveName;
}

return $curveName;
}

CGTalk Moderation
05-03-2006, 08:18 PM
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.