// =========================================================================== // 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 28, 1997 // // Description: // The offsetSurfacePreset() procedure executes a offset surface operation on // a surface based on the offset option vars. // // Input Arguments: // None. // // Return Value: // None. // proc string pieceTogetherOffsetSurfaceCmd( int $history, int $method, float $distance) // // Description : // Piece together a offsetSurface command. // { string $cmd; $cmd = "offsetSurface "; // construction history $cmd = $cmd + " -ch "; if ( $history == 1 ) $cmd = $cmd + "on"; else $cmd = $cmd + "off"; // method and distance $cmd = $cmd + " -m " + $method; $cmd = $cmd + " -d " + $distance; return $cmd; } global proc offsetSurfacePreset( int $history, int $method, float $distance) // // offsetSurface with the preset options. // Use this proc when operation dragged to Shelf. // { // Get the list of nurbs surfaces selected. Do this here because // addViewNormal creates a node which will blow away the selection // list // global int $gSelectNurbsSurfacesBit; string $surfacesList[] = `filterExpand -ex true -sm $gSelectNurbsSurfacesBit`; // build the command string $cmd = pieceTogetherOffsetSurfaceCmd($history, $method, $distance); // placeholder for one selection item int $nitems = 1; $cmd = appendToCmdPlaceHoldersForSelectionItems( $cmd, $nitems ); int $numSurfaces = size($surfacesList) ; if( $numSurfaces < 1 ) { error (uiRes("m_offsetSurfacePreset.kInvalidSelection")); } else { // compute each offset in turn string $offsetResults[]; string $surface[1]; for( $i = 0 ; $i < $numSurfaces ; $i++ ) { $surface[0] = $surfacesList[$i]; string $results[] = executeCmdOnItems( $cmd, $surface ); $offsetResults = stringArrayCatenate($offsetResults, $results); } // select the results. select -r $offsetResults; } }