GetCurveLength-ctrl-i

From scripting
Revision as of 05:42, 22 April 2017 by Nickpisca (talk | contribs) (Created page with "Direct: http://crtl-i.com/blog/?p=16 proc float getCurveLength( string $curve ) { string $arcLenNode = `createNode arcLengthDimension`; connectAttr -f ( $curve + “.wor...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Direct: http://crtl-i.com/blog/?p=16

proc float getCurveLength( string $curve )
{
string $arcLenNode = `createNode arcLengthDimension`;
connectAttr -f ( $curve + “.worldSpace[0]” ) ( $arcLenNode + “.nurbsGeometry” );

setAttr ( $arcLenNode + “.uParamValue” ) `getAttr ( $curve + “.maxValue” )`;

float $curveLength = `getAttr ( $arcLenNode + “.arcLength” )`; 

string $parent[] = `listRelatives -p $arcLenNode`;
delete $parent;

return $curveLength;
}


More information on working with attributes and querying, read pages 85-102 in YSYT.