MEL How-To #58 | ||
| ||
How do I determine how many CVs are in a NURBS Curve or Surface?To determine how many CVs are in a curve:
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;
To select all CVs in this curve:
select ( $curve + ".cv[0:" + ($numCVs-1) + "]" );
// or simply...
select ( $curve + ".cv[*]" );
To determine how many CVs are in a surface: string $surface = "nurbsSphereShape1"; int $numSpansU = `getAttr ( $surface + ".spansU" )`; int $degreeU = `getAttr ( $surface + ".degreeU" )`; int $numSpansV = `getAttr ( $surface + ".spansV" )`; int $degreeV = `getAttr ( $surface + ".degreeV" )`; int $formU = `getAttr ( $surface + ".formU" )`; int $formV = `getAttr ( $surface + ".formV" )`; int $numCVsU = $numSpansU + $degreeU; // Adjust for periodic hull: if ( $formU == 2 ) $numCVsU -= $degreeU; int $numCVsV = $numSpansV + $degreeV; // Adjust for periodic hull: if ( $formV == 2 ) $numCVsV -= $degreeV; // Total CVs is U count times V count. int $numCVs = $numCVsU * $numCVsV; To select all CVs in this surface:
select ( $surface + ".cv[0:" + ($numCVsU-1) + "][0:"
+ ($numCVsV-1) + "]" );
// or simply...
select ( $surface + ".cv[*][*]" );
Related How-To's29 Jan 2005 | ||
Copyright ©2005 by Bryan Ewert, maya@ewertb.com Maya is a Registered Trademark of Alias |