Maya Curves

Here is a little script I found from here, that allows you to query the amount of points (or cv’s) on a curve, where curveShape1 is the name of the curve you have created.

string $curve = "curveShape1";

int $numSpans = `getAttr ( $curve + ".spans" )`;
int $degree   = `getAttr ( $curve + ".degree" )`;
int $form     = `getAttr ( $curve + ".form" )`;

int $numCVs   = $numSpans + $degree;

// Adjust for periodic curve:
if ( $form == 2 ) $numCVs -= $degree;

I then used this to be able to spread the cv’s along the y axis, where ‘curve1’ is the name of your curve.

for ($i = 0; $i < $numCVs; ++$i ) 
{
    vector $low = `pointPosition -w  curve1.cv[0]`;
    vector $high = `pointPosition -w curve1.cv[$numCVs-1]`;
    float $gap = ($high.y - $low.y)/($numCVs-1);
    vector $pos = `pointPosition -w curve1.cv[$i]`;
    select curve1.cv[$i];
    $var = $lowNew.y + $i*$gap;  
    move -y $var;
};

Gary

Leave a Reply

Your email address will not be published. Required fields are marked *