// =========================================================================== // 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 29, 1997 // // Description: // The circularFilletPreset() procedure executes one circular fillet ( // rollingBall fillet really !) operation given two NURBS surfaces, // based on the option vars. // // Input Arguments: // None. // // Return Value: // None. // proc string pieceTogetherCmd( int $doHistory, int $asPolygons, float $pr, int $revPrimary, int $revSecondary, float $c0tol, float $g1tol, int $genCos ) // // Description : // Put together an extrude Cmd. // { string $cmd = "circularFillet" ; // history. // $cmd = $cmd + " -ch " ; if( $doHistory == 1 ) $cmd = $cmd + "true" ; else $cmd = $cmd + "false" ; //$cmd = $cmd + " -po " ; //if( $asPolygons == 1 ) $cmd = $cmd + "true" ; //else $cmd = $cmd + "false" ; // primary radius. // $cmd = $cmd + " -pr " ; float $prad = $pr ; if( $revPrimary == 1 ) $prad = $prad * -1 ; $cmd = $cmd + $prad ; // secondary radius. // $cmd = $cmd + " -sr " ; float $srad = $pr ; if( $revSecondary == 1 ) $srad = $srad * -1 ; $cmd = $cmd + $srad ; // position continuity tol. // $cmd = $cmd + " -pt " ; $cmd = $cmd + $c0tol ; // g1 continuity tolerance. // $cmd = $cmd + " -tt " ; $cmd = $cmd + $g1tol ; // generate cos. // $cmd = $cmd + " -cos " ; if( $genCos == 1 ) { $cmd = $cmd + "true" ; } else { $cmd = $cmd + "false" ; } return $cmd ; } global proc circularFilletPreset( int $doHistory, int $asPolygons, float $pr, int $revPrimary, int $revSecondary, float $c0tol, float $g1tol, int $genCos ) // // Description : // Proc to do one circular fillet operation. // { //--------------------------------------------- // Get the list of nurbs surfaces in select list. //--------------------------------------------- // global int $gSelectNurbsSurfacesBit; global int $gSelectIsoparmsBit; global int $gSelectSurfaceParmPointsBit; global int $gSelectCurvesOnSurfacesBit; string $inpList[] = `filterExpand -ex true -sm $gSelectNurbsSurfacesBit `; string $filletPair[2]; //-------------------------------------------- // Valid # of items. //-------------------------------------------- // int $count = size($inpList) ; if( $count >= 2 ) { if( $count > 2 ) { warning ((uiRes("m_circularFilletPreset.kWarningTooManySurfaces")) ); } $filletPair[0] = $inpList[$count-2]; $filletPair[1] = $inpList[$count-1]; } else { $revPrimary = 0; $revSecondary = 0; if( $pr < 0 ) $pr = -1 * $pr; $inpList = `filterExpand -ex true -sm $gSelectIsoparmsBit -sm $gSelectSurfaceParmPointsBit`; $count = size($inpList) ; // These would be isoparms or surface points: if( $count >= 2 ) { if( $count > 2 ) { warning ((uiRes("m_circularFilletPreset.kWarningTwooManyIsoparms")) ); } $filletPair[0] = $inpList[$count-2]; $filletPair[1] = $inpList[$count-1]; } } if( $count < 2 ) { error (uiRes("m_circularFilletPreset.kCircFilletInvalSelection")); } if( $count >= 2 ) { //--------------------------------------- // put together an rolling ball fillet cmd. //--------------------------------------- // string $cmd = pieceTogetherCmd( $doHistory, $asPolygons, $pr, $revPrimary, $revSecondary, $c0tol, $g1tol, $genCos); //---------------------------------------- // place holders for 2 selection items. //---------------------------------------- // int $nitems = 2 ; $cmd = appendToCmdPlaceHoldersForSelectionItems($cmd,$nitems) ; string $results[] = executeCmdOnItems($cmd,$filletPair); // select all results. // $count = size($results) ; $selectString = "select -r "; int $i ; for( $i = 0 ; $i < $count ; $i++ ) { $selectString += $results[$i] ; $selectString += " "; } $selectString += ";"; select -cl ; eval($selectString) ; } }