// =========================================================================== // 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: Mar. 14, 1997 // // Description: // The revolvePreset() procedure executes a revolve operation on each // selected object. // global proc revolvePreset( int $doHistory, int $outputPolys, int $partialCrvRange, float $startSweep, float $endSweep, int $useTol, float $tol, int $degree, int $numSegments, int $useLocalPivot, float $axisX, float $axisY, float $axisZ, float $pivotX, float $pivotY, float $pivotZ ) { // Get a list of curves to revolve and execute the revolve cmd on each. // Allowable curves: nurbsCurves, isoparms, cos, surf edges // global int $gSelectNurbsCurvesBit; global int $gSelectIsoparmsBit; global int $gSelectCurvesOnSurfacesBit; global int $gSelectSurfaceEdgeBit; global int $gSelectMeshEdge; // Piece together the revolve command // string $cmd; $cmd = ( "revolve " + " -ch " + $doHistory + " -po " + $outputPolys + " -rn " + $partialCrvRange + " -ssw " + $startSweep + " -esw " + $endSweep + " -ut " + $useTol + " -tol " + $tol + " -degree " + $degree + " -s " + $numSegments + " -ulp " + $useLocalPivot + " -ax " + $axisX + " " + $axisY + " " + $axisZ ); if( ! $useLocalPivot ) { $cmd = $cmd + " -p " + $pivotX + " " + $pivotY + " " + $pivotZ; } string $curveList[] = `filterExpand -ex true -sm $gSelectMeshEdge -sm $gSelectNurbsCurvesBit -sm $gSelectIsoparmsBit -sm $gSelectCurvesOnSurfacesBit -sm $gSelectSurfaceEdgeBit`; if( size($curveList) > 0 ) { $cmd += " %s;"; string $revolveResults[] = executeForEachObject( $curveList, $cmd ); if( (size($revolveResults)) == 0 ) { string $msg = (uiRes("m_revolvePreset.kFailedError")); error($msg); } else { // Select all the results with one select command. Note that only // resulting surfaces are selected, not dependency nodes. // string $selectString; $selectString = "select "; int $i; int $numResults = size($revolveResults); for( $i = 0; $i < $numResults; $i ++ ) { $selectString += $revolveResults[$i]; $selectString += " "; } $selectString += ";"; select -cl; eval($selectString); } } else { string $msg = (uiRes("m_revolvePreset.kNoValidItems")); error($msg); } }