// =========================================================================== // 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 1, 1997 // // Description: // The projectTangentPreset() procedure executes projectTangent operation. // // Input Arguments: // None. // // Return Value: // None. // proc string pieceTogetherCmd( int $doHistory, int $keepOriginal, int $keepCurvature, int $revTangent, int $tanAlignDir, float $tanScale, float $curScale, float $rotAngle, int $ignoreEdges) // // Description : // Put together a projectTangent Cmd. // { string $cmd = "projectTangent" ; // history. // $cmd = $cmd + " -ch " ; if( $doHistory == 1 ) $cmd = $cmd + "true" ; else $cmd = $cmd + "false" ; // replace original // $cmd = $cmd + " -rpo " ; if( $keepOriginal == 1 ) $cmd = $cmd + "false" ; else $cmd = $cmd + "true" ; // keep tangent ( or curvature ) // $cmd = $cmd + " -c " ; if( $keepCurvature == 1 ) $cmd = $cmd + "true" ; else $cmd = $cmd + "false" ; // reverseTangent direction. // $cmd = $cmd + " -rt " ; if( $revTangent == 1 ) $cmd = $cmd + " true " ; else $cmd = $cmd + " false " ; // tangent Align direction. // $cmd = $cmd + " -td " ; $cmd = $cmd + $tanAlignDir ; // tangent scale. // $cmd = $cmd + " -ts " ; $cmd = $cmd + $tanScale ; // curvature scale. // if($keepCurvature == 1 ) { $cmd = $cmd + " -cs " ; $cmd = $cmd + $curScale ; } if( $tanAlignDir != 3 ) { $cmd = $cmd + " -ro " ; $cmd = $cmd + $rotAngle ; } // ignore edges? if ($ignoreEdges == 1) { $cmd = $cmd + " -ie true "; } return $cmd ; } global proc projectTangentPreset( int $doHistory, int $keepOriginal, int $keepCurvature, int $revTangent, int $tanAlignDir, float $tanScale, float $curScale, float $rotAngle, int $ignoreEdges) // // Description : // Proc to do a project Tangent // { //--------------------------------------- // put together a projectTangent cmd. //--------------------------------------- // string $cmd = pieceTogetherCmd( $doHistory, $keepOriginal, $keepCurvature, $revTangent, $tanAlignDir, $tanScale, $curScale, $rotAngle, $ignoreEdges) ; //--------------------------------------------- // Get the list of nurbs curves to be projected // from the select list. //--------------------------------------------- // global int $gSelectNurbsCurvesBit; global int $gSelectNurbsSurfacesBit; global int $gSelectIsoparmsBit; string $curveList[] = `filterExpand -ex true -sm $gSelectNurbsCurvesBit`; string $srfList[] = `filterExpand -ex true -sm $gSelectNurbsSurfacesBit -sm $gSelectIsoparmsBit` ; //-------------------------------------------- // Valid # of items. //-------------------------------------------- // int $curveCount = size($curveList) ; int $srfCount = size($srfList) ; string $list[3] ; string $projectResults[] ; string $results[] ; int $i ; int $nitems = -1 ; if( $curveCount > 0 && $srfCount == 1 ) $nitems = 2 ; else if( $curveCount == 3 && $srfCount == 0 ) $nitems = 3 ; if( $nitems == 2 || $nitems == 3 ) { $cmd = appendToCmdPlaceHoldersForSelectionItems($cmd,$nitems) ; if ( $nitems == 2 ) { // do project tangent of each curve with the surface // $list[1] = $srfList[0]; for ( $i = 0; $i < $curveCount; $i++ ) { $list[0] = $curveList[$i]; $results = executeCmdOnItems($cmd, $list); // add all the results to the $projectResults array // appendStringArray( $projectResults, $results, size($results) ); } } else { // do project tangent of 3 curves // for( $i = 0 ; $i < $curveCount ; $i++ ) $list[$i] = $curveList[$i]; $projectResults = executeCmdOnItems($cmd,$list); } $resultCount = size($projectResults) ; $selectString = "select -r "; for( $i = 0 ; $i < $resultCount ; $i++ ) { $selectString += $projectResults[$i] ; $selectString += " "; } $selectString += ";"; select -cl ; eval($selectString) ; } else { string $msg = (uiRes("m_projectTangentPreset.kSelectionError")); error($msg); } }