GetCurveLength-ctrl-i

From scripting
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.