// =========================================================================== // 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 doCloseCurveArgList() procedure executes a close operation on each // selected object based on the close option vars. // // Versions: // 1 - Maya V1 and V1.5 // 2 - Maya V2 proc string doCloseCurveAssemble( string $version, string $args[] ) { string $cmd = ""; int $need = 0; if( "1" == $version ) { $need = 3; } else if( "2" == $version ) { $need = 6; } else { string $msg = (uiRes("m_doCloseCurveArgList.kBadVersionWarning")); warning( $msg ); $version = "1"; $need = 3; } if( size($args) < $need ) { string $msg = (uiRes("m_doCloseCurveArgList.kNotEnoughArgsError")); error($msg); return $cmd; } $cmd = " -ch " + $args[0]; $cmd = $cmd + " -ps " + $args[1]; $cmd = $cmd + " -rpo " + $args[2]; if( "2" == $version ) { $cmd = $cmd + " -bb " + $args[3]; $cmd = $cmd + " -bki " + $args[4]; $cmd = $cmd + " -p " + $args[5]; } return $cmd; } global proc doCloseCurveArgList( string $version, string $args[] ) { // Get a list of each type of acceptable object type - // curves, and curves-on-surface. // global int $gSelectNurbsCurvesBit; global int $gSelectCurvesOnSurfacesBit; string $curveList[] = `filterExpand -ex true -sm $gSelectNurbsCurvesBit`; string $COSList[] = `filterExpand -ex true -sm $gSelectCurvesOnSurfacesBit`; // Set up command strings for each command and execute them: // closeSurface and closeCurve and closeCurve for curves-on-surface. // string $cmd; $cmd = "closeCurve" + doCloseCurveAssemble( $version, $args ) + " %s;"; string $curveResults[] = executeForEachObject( $curveList, $cmd ); $cmd = "closeCurve" + doCloseCurveAssemble($version,$args) + " -cos on %s;"; string $cosResults[] = executeForEachObject( $COSList, $cmd ); // Process all the results - if there weren't any then display a error // if( (size($curveResults) + size($cosResults) ) == 0 ) { string $msg = (uiRes("m_doCloseCurveArgList.kNothingSelectedError")); error ($msg); } else { // Select all the results with one select command. Note that only // resulting surfaces and curves are selected, not dependency nodes. // string $selectString; $selectString = "select "; int $i; int $numCurves = size($curveResults); for( $i = 0; $i < $numCurves; $i ++ ) { $selectString += $curveResults[$i]; $selectString += " "; } int $numCOS = size($cosResults); for( $i = 0; $i < $numCOS; $i ++ ) { $selectString += $cosResults[$i]; $selectString += " "; } $selectString += ";"; select -cl; eval($selectString); } }