// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // // Creation Date: Sept 24, 1998 // // Description: // This procedure executes a smoothCurve operation on each // selected object. // global proc performSmoothCurvePreset( int $h, int $rpo, float $s ) { global int $gSelectNurbsCurvesBit; global int $gSelectCVsBit; string $cvs[] = `filterExpand -ex true -sm $gSelectCVsBit`; string $curves[] = `filterExpand -ex true -sm $gSelectNurbsCurvesBit`; if( size( $cvs ) > 0 ){ string $curveNames[] = groupObjectsByName( $cvs, "\\." ); int $curvesToSmooth = size( $curveNames ); int $curve; string $command; string $allResults[]; string $commandResults[]; int $result; for( $curve = 0; $curve < $curvesToSmooth; $curve += 1 ){ $command = "smoothCurve" + " -ch " + $h + " -rpo " + $rpo + " -s " + $s + " " + $curveNames[ $curve ]; clear( $commandResults ); $commanResults = evalEcho( $command ); for( $result = 0; $result < size( $commanResults ); $result += 1 ){ $allResults[ size( $allResults ) ] = $commanResults[ $result ]; } } select $allResults; } else if( size( $curves ) > 0 ) { int $curvesToSmooth = size( $curves ); int $curve; string $command; string $allResults[]; string $commandResults[]; int $result; for( $curve = 0; $curve < $curvesToSmooth; $curve += 1 ){ $command = "smoothCurve" + " -ch " + $h + " -rpo " + $rpo + " -s " + $s + " " + ($curves[ $curve ] + ".cv[\"*\"]"); clear( $commandResults ); $commanResults = evalEcho( $command ); for( $result = 0; $result < size( $commanResults ); $result += 1 ){ $allResults[ size( $allResults ) ] = $commanResults[ $result ]; } } select $allResults; } else{ string $msg = (uiRes("m_performSmoothCurvePreset.kNoValidItems")); error($msg); } }