// =========================================================================== // 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: April 23, 1997 // // Description: // The extendCurvePreset() procedure executes a extend curve operation on // a curve based on the extend option vars. // // Input Arguments: // None. // // Return Value: // None. // proc string pieceTogetherExtendCurveCmd( int $cos, int $history, int $method, int $extendType, float $distance, float $toPointX, float $toPointY, float $toPointZ, int $start, int $join, int $removeMultKnots, int $replaceOriginal ) // // Description : // Piece together a extendCurve command. // { string $cmd; $cmd = "extendCurve -cos " + $cos; // construction history $cmd = $cmd + " -ch " + $history; // extend method // if( $method == 0 ) { $cmd = $cmd + " -em 0"; $cmd = $cmd + " -et " + $extendType; $cmd = $cmd + " -d " + $distance; } else { $cmd = $cmd + " -em 2"; $cmd = $cmd + " -px " + $toPointX; $cmd = $cmd + " -py " + $toPointY; $cmd = $cmd + " -pz " + $toPointZ; } $cmd = $cmd + " -s " + $start; // join, removeMultKnots, replaceOriginal // if( $join == 0 ) { // when join is off, removeMultKnots & replace original cannot be done $cmd = $cmd + " -jn false -rmk false -rpo false"; } else { $cmd = $cmd + " -jn true"; if ( $removeMultKnots == 1 ) $cmd = $cmd + " -rmk true"; else $cmd = $cmd + " -rmk false"; if ( $replaceOriginal == 1 ) $cmd = $cmd + " -rpo on"; else $cmd = $cmd + " -rpo off"; } $cmd += " %s "; return $cmd; } global proc extendCurvePresetArgList( string $version, string $args[] ) // // ExtendCurve with the preset options. // Use this proc when operation dragged to Shelf. // { int $cos, $history, $method, $extendType; float $distance, $toPointX, $toPointY, $toPointZ; int $start, $join, $removeMultKnots, $replaceOriginal; // Depending on the version, the argument lists are different. // Version 1 of this procedure had 11 args only. // Versions after 1 have 12 args, where the first arg is for COS capability // if( $version == "1") { $cos = 0; $history = $args[0]; $method = $args[1]; $extendType = $args[2]; $distance = $args[3]; $toPointX = $args[4]; $toPointY = $args[5]; $toPointZ = $args[6]; $start = $args[7]; $join = $args[8]; $removeMultKnots = $args[9]; $replaceOriginal = $args[10]; } else { $cos = $args[0]; $history = $args[1]; $method = $args[2]; $extendType = $args[3]; $distance = $args[4]; $toPointX = $args[5]; $toPointY = $args[6]; $toPointZ = $args[7]; $start = $args[8]; $join = $args[9]; $removeMultKnots = $args[10]; $replaceOriginal = $args[11]; } string $cmd = pieceTogetherExtendCurveCmd( $cos, $history, $method, $extendType, $distance, $toPointX, $toPointY, $toPointZ, $start, $join, $removeMultKnots, $replaceOriginal ); // Get the list of nurbs curves selected. // global int $gSelectNurbsCurvesBit; global int $gSelectCurvesOnSurfacesBit; global int $gSelectCurveParmPointsBit; string $curveList[]; if( $cos ) { $curveList = `filterExpand -ex true -sm $gSelectCurvesOnSurfacesBit`; } else { $curveList = `filterExpand -ex true -sm $gSelectNurbsCurvesBit -sm $gSelectCurvesOnSurfacesBit`; } int $numCurves = size($curveList); if ( $numCurves == 0 ) { string $msg = (uiRes("m_extendCurvePresetArgList.kNoCurvesSelected")); error($msg); } else { string $extendResults[] = executeForEachObject( $curveList, $cmd ); // select the results. // int $resultCount = size($extendResults); if ( $resultCount > 0 ) { string $selectString; $selectString = "select "; int $i; for ( $i = 0; $i < $resultCount; $i++ ) { $selectString += $extendResults[$i]; $selectString += " "; } $selectString += ";"; select -cl; eval($selectString); } } }