// =========================================================================== // 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: 14 January 1999 // // // Procedure Name: // nurbsBoolean1ToolScript // // Input Arguments: // what is going to happen when this script is called // $setToTool = 0 ==> do the command // $setToTool = 1 ==> show option box // $setToTool = 2 ==> return the command // $setToTool = 3 ==> show tool option box // $setToTool = 4 ==> enter the tool // // Return Value: // None. // proc createNurbsBooleanContext( int $whichOne, string $tool ) { string $selectNURBSForFirst = (uiRes("m_nurbsBooleanToolScript.kSelectNURBSForFirst")); string $selectAdditionalFirstOrSecond = (uiRes("m_nurbsBooleanToolScript.kSelectAdditionalFirstOrSecond")); string $selectNURBSForSecond = (uiRes("m_nurbsBooleanToolScript.kSelectNURBSForSecond")); if( ! `licenseCheck -m "edit" -typ "model"` ) return; switch ($whichOne) { case 0: if( ! `scriptCtx -exists $tool` ) { scriptCtx -i1 "nurbsShellUnion.png" -bcn "nurbsBooleanUnion" -title (uiRes("m_nurbsBooleanToolScript.kUnionTool")) -toolCursorType "edit" -totalSelectionSets 2 -cumulativeLists true -expandSelectionList true -enableRootSelection true -exitUponCompletion true -fcs ("performBoolean 0 0 " + "$Selection1 \`currentCtx\`") -setNoSelectionPrompt $selectNURBSForFirst -setSelectionPrompt $selectAdditionalFirstOrSecond -setAutoToggleSelection true -setAutoComplete false -setSelectionCount 0 -nurbsSurface true -setNoSelectionPrompt $selectNURBSForSecond -setSelectionPrompt (uiRes("m_nurbsBooleanToolScript.kSelectAdditionalSecondUnion")) -setAutoToggleSelection true -setAutoComplete false -setSelectionCount 0 -nurbsSurface true $tool; } break; case 1: if( ! `scriptCtx -exists $tool` ) { scriptCtx -i1 "nurbsShellSubtract.png" -bcn "nurbsBooleanSubtract" -title (uiRes("m_nurbsBooleanToolScript.kDifferenceTool")) -toolCursorType "edit" -totalSelectionSets 2 -cumulativeLists true -expandSelectionList true -enableRootSelection true -exitUponCompletion true -fcs ("performBoolean 0 1 " + "$Selection1 \`currentCtx\`") -setNoSelectionPrompt $selectNURBSForFirst -setSelectionPrompt $selectAdditionalFirstOrSecond -setAutoToggleSelection true -setAutoComplete false -setSelectionCount 0 -nurbsSurface true -setNoSelectionPrompt $selectNURBSForSecond -setSelectionPrompt (uiRes("m_nurbsBooleanToolScript.kSelectAdditionalSecondDifference")) -setAutoToggleSelection true -setAutoComplete false -setSelectionCount 0 -nurbsSurface true $tool; } break; case 2: default: if( ! `scriptCtx -exists $tool` ) { scriptCtx -i1 "nurbsShellIntersect.png" -bcn "nurbsBooleanIntersect" -title (uiRes("m_nurbsBooleanToolScript.kIntersectionTool")) -toolCursorType "edit" -totalSelectionSets 2 -cumulativeLists true -expandSelectionList true -enableRootSelection true -exitUponCompletion true -fcs ("performBoolean 0 2 " + "$Selection1 \`currentCtx\`") -setNoSelectionPrompt $selectNURBSForFirst -setSelectionPrompt $selectAdditionalFirstOrSecond -setAutoToggleSelection true -setAutoComplete false -setSelectionCount 0 -nurbsSurface true -setNoSelectionPrompt $selectNURBSForSecond -setSelectionPrompt (uiRes("m_nurbsBooleanToolScript.kSeectAdditionalSecondIntersect")) -setAutoToggleSelection true -setAutoComplete false -setSelectionCount 0 -nurbsSurface true $tool; } break; } } global proc string nurbsBooleanToolScript( int $setToTool, int $whichOne ) // // Description : // $setToTool = 0 ==> do the command // $setToTool = 1 ==> show option box // $setToTool = 2 ==> return the command // $setToTool = 3 ==> show tool option box // $setToTool = 4 ==> enter the tool { string $tool = ""; if( $setToTool > 2 ) { switch( $whichOne ) { case 0: $tool = "nurbsBooleanUnionContext"; break; case 1: $tool = "nurbsBooleanSubtractContext"; break; case 2: default: $tool = "nurbsBooleanIntersectContext"; break; } createNurbsBooleanContext( $whichOne, $tool ); } string $result = ""; switch ($setToTool) { case 4: setToolTo $tool; break; default: $result = eval( "performBoolean " + $setToTool + " " + $whichOne + " {\" \", \" \"} \"" + $tool + "\"" ); break; } return $result; }