// =========================================================================== // 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: July 24, 1998 // // // Description: // This script is defines the option box for the birail surface menu item. // // Input Arguments: // int action // 0 - show the option box dialog // 1 - just execute the birail operation // 2 - return the script that would do it // 3 - pretend you are a tool instead // // Return Value: // None. // proc setOptionVars1( int $forceFactorySettings ) { if( $forceFactorySettings || !`optionVar -exists birail1TransformProp` ) { optionVar -intValue birail1TransformProp 1; } if( $forceFactorySettings || !`optionVar -exists birail1BlendFirstProfile`) { optionVar -intValue birail1BlendFirstProfile 0; } if( $forceFactorySettings || !`optionVar -exists birail1BlendValue` ) { optionVar -floatValue birail1BlendValue 0.5; } if($forceFactorySettings || !`optionVar -exists birail1RebuildFirstProfile`){ optionVar -intValue birail1RebuildFirstProfile 0; } if($forceFactorySettings || !`optionVar -exists birail1RebuildLastProfile`) { optionVar -intValue birail1RebuildLastProfile 0; } if( $forceFactorySettings || !`optionVar -exists birail1RebuildFirstRail` ) { optionVar -intValue birail1RebuildFirstRail 0; } if( $forceFactorySettings || !`optionVar -exists birail1RebuildLastRail` ) { optionVar -intValue birail1RebuildLastRail 0; } if( $forceFactorySettings || !`optionVar -exists birail1OutputPoly` ) { optionVar -intValue birail1OutputPoly 0; } rebuildCurveSetOptionVars( $forceFactorySettings ); } proc setOptionVars2( int $forceFactorySettings ) { if( $forceFactorySettings || !`optionVar -exists birail2TransformProp` ) { optionVar -intValue birail2TransformProp 1; } if( $forceFactorySettings || !`optionVar -exists birail2BlendFirstProfile`) { optionVar -intValue birail2BlendFirstProfile 0; } if( $forceFactorySettings || !`optionVar -exists birail2BlendLastProfile` ) { optionVar -intValue birail2BlendLastProfile 0; } if( $forceFactorySettings || !`optionVar -exists birail2BlendValue` ) { optionVar -floatValue birail2BlendValue 0.5; } if($forceFactorySettings || !`optionVar -exists birail2RebuildFirstProfile`){ optionVar -intValue birail2RebuildFirstProfile 0; } if($forceFactorySettings || !`optionVar -exists birail2RebuildLastProfile`) { optionVar -intValue birail2RebuildLastProfile 0; } if( $forceFactorySettings || !`optionVar -exists birail2RebuildFirstRail` ) { optionVar -intValue birail2RebuildFirstRail 0; } if( $forceFactorySettings || !`optionVar -exists birail2RebuildLastRail` ) { optionVar -intValue birail2RebuildLastRail 0; } if( $forceFactorySettings || !`optionVar -exists birail2OutputPoly` ) { optionVar -intValue birail2OutputPoly 0; } rebuildCurveSetOptionVars( $forceFactorySettings ); } proc setOptionVars3( int $forceFactorySettings ) { if( $forceFactorySettings || !`optionVar -exists birail3TransformProp` ) { optionVar -intValue birail3TransformProp 1; } if( $forceFactorySettings || !`optionVar -exists birail3BlendFirstProfile`) { optionVar -intValue birail3BlendFirstProfile 0; } if( $forceFactorySettings || !`optionVar -exists birail3BlendLastProfile` ) { optionVar -intValue birail3BlendLastProfile 0; } if( $forceFactorySettings || !`optionVar -exists birail3BlendValue` ) { optionVar -floatValue birail3BlendValue 0.5; } if($forceFactorySettings || !`optionVar -exists birail3RebuildFirstProfile`){ optionVar -intValue birail3RebuildFirstProfile 0; } if($forceFactorySettings || !`optionVar -exists birail3RebuildLastProfile`) { optionVar -intValue birail3RebuildLastProfile 0; } if( $forceFactorySettings || !`optionVar -exists birail3RebuildFirstRail` ) { optionVar -intValue birail3RebuildFirstRail 0; } if( $forceFactorySettings || !`optionVar -exists birail3RebuildLastRail` ) { optionVar -intValue birail3RebuildLastRail 0; } if( $forceFactorySettings || !`optionVar -exists birail3OutputPoly` ) { optionVar -intValue birail3OutputPoly 0; } rebuildCurveSetOptionVars( $forceFactorySettings ); } global proc birailVisibility( string $parent, int $whichOne, int $showRebuild ) { setParent $parent; if( 2 == $whichOne ) { floatSliderGrp -e -en true birailBlendValueWidget; } if( -1 == $showRebuild ) { int $rfp = `checkBoxGrp -q -v1 birailRebuildProfileWidget`; int $rlp = 0; if( 1 != $whichOne ) { $rlp = `checkBoxGrp -q -v2 birailRebuildProfileWidget`; } int $rfr = `checkBoxGrp -q -v1 birailRebuildRailWidget`; int $rlr = `checkBoxGrp -q -v2 birailRebuildRailWidget`; $showRebuild = ($rfp || $rlp || $rfr || $rlr); } if( $showRebuild ) { tabLayout -e -vis true rebuildOptions; } else { tabLayout -e -vis false rebuildOptions; } } proc string assembleCmd1() // // Description : // To assemble birail1 proc. // { setOptionVars1(false); string $cmd; int $history = `constructionHistory -q -tgl`; int $prop = `optionVar -q birail1TransformProp`; int $bfp = `optionVar -q birail1BlendFirstProfile`; int $blp = 0; float $bv = `optionVar -q birail1BlendValue`; int $rfp = `optionVar -q birail1RebuildFirstProfile`; int $rlp = `optionVar -q birail1RebuildLastProfile`; int $rfr = `optionVar -q birail1RebuildFirstRail`; int $rlr = `optionVar -q birail1RebuildLastRail`; int $poly = `optionVar -q birail1OutputPoly`; if( !`isTrue "SurfaceUIExists"` ) $poly = 1; $cmd = "birailPreset 1 {"; $cmd = $cmd + "\"" + $history + "\", "; $cmd = $cmd + "\"" + $prop + "\", "; $cmd = $cmd + "\"" + $bfp + "\", "; $cmd = $cmd + "\"" + $blp + "\", "; $cmd = $cmd + "\"" + $bv + "\", "; $cmd = $cmd + "\"" + $rfp + "\", "; $cmd = $cmd + "\"" + $rlp + "\", "; $cmd = $cmd + "\"" + $rfr + "\", "; $cmd = $cmd + "\"" + $rlr + "\", "; $cmd = $cmd + "\"" + $poly + "\" }"; return $cmd; } proc string assembleCmd2() // // Description : // To assemble birail2 proc. // { setOptionVars2(false); string $cmd; int $history = `constructionHistory -q -tgl`; int $prop = `optionVar -q birail2TransformProp`; int $bfp = `optionVar -q birail2BlendFirstProfile`; float $bv = `optionVar -q birail2BlendValue`; int $blp = `optionVar -q birail2BlendLastProfile`; int $rfp = `optionVar -q birail2RebuildFirstProfile`; int $rlp = `optionVar -q birail2RebuildLastProfile`; int $rfr = `optionVar -q birail2RebuildFirstRail`; int $rlr = `optionVar -q birail2RebuildLastRail`; int $poly = `optionVar -q birail2OutputPoly`; if( !`isTrue "SurfaceUIExists"` ) $poly = 1; $cmd = "birailPreset 1 {"; $cmd = $cmd + "\"" + $history + "\", "; $cmd = $cmd + "\"" + $prop + "\", "; $cmd = $cmd + "\"" + $bfp + "\", "; $cmd = $cmd + "\"" + $blp + "\", "; $cmd = $cmd + "\"" + $bv + "\", "; $cmd = $cmd + "\"" + $rfp + "\", "; $cmd = $cmd + "\"" + $rlp + "\", "; $cmd = $cmd + "\"" + $rfr + "\", "; $cmd = $cmd + "\"" + $rlr + "\", "; $cmd = $cmd + "\"" + $poly + "\" }"; return $cmd; } proc string assembleCmd3() // // Description : // To assemble birail3 proc. // { setOptionVars3(false); string $cmd; int $history = `constructionHistory -q -tgl`; int $prop = `optionVar -q birail3TransformProp`; int $bfp = `optionVar -q birail3BlendFirstProfile`; int $blp = `optionVar -q birail3BlendLastProfile`; float $bv = `optionVar -q birail3BlendValue`; int $rfp = `optionVar -q birail3RebuildFirstProfile`; int $rlp = `optionVar -q birail3RebuildLastProfile`; int $rfr = `optionVar -q birail3RebuildFirstRail`; int $rlr = `optionVar -q birail3RebuildLastRail`; int $poly = `optionVar -q birail3OutputPoly`; if( !`isTrue "SurfaceUIExists"` ) $poly = 1; $cmd = "birailPreset 1 {"; $cmd = $cmd + "\"" + $history + "\", "; $cmd = $cmd + "\"" + $prop + "\", "; $cmd = $cmd + "\"" + $bfp + "\", "; $cmd = $cmd + "\"" + $blp + "\", "; $cmd = $cmd + "\"" + $bv + "\", "; $cmd = $cmd + "\"" + $rfp + "\", "; $cmd = $cmd + "\"" + $rlp + "\", "; $cmd = $cmd + "\"" + $rfr + "\", "; $cmd = $cmd + "\"" + $rlr + "\", "; $cmd = $cmd + "\"" + $poly + "\" }"; return $cmd; } proc string assembleCmd( int $whichOne ) { string $res = ""; switch( $whichOne ) { case 1: $res = `assembleCmd1`; break; case 2: $res = `assembleCmd2`; break; case 3: default: $res = `assembleCmd3`; break; } return $res; } proc birailOptions( int $inTheTool, int $whichOne, string $goToTool ) { // Name of the command for this option box. // string $commandName = "birail"; // Build the option box actions. // string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); // Step 1: Get the option box. // ============================ string $layout = getOptionBox(); setParent $layout; // Step 2: Pass the command name to the option box. // ================================================= setOptionBoxCommandName($commandName); // Step 3: Activate the default UI template. // ========================================== setUITemplate -pushTemplate DefaultTemplate; // Step 4: Create option box contents. // =================================== // Turn on the wait cursor. // waitCursor -state 1; tabLayout -scr true -tv false; string $parent = `columnLayout -adjustableColumn 1`; radioButtonGrp -nrb 2 -label (uiRes("m_performBirail.kTransformControl")) -label1 (uiRes("m_performBirail.kNonProportional")) -label2 (uiRes("m_performBirail.kProportional")) birailTransformPropWidget; if( 2 == $whichOne ) { floatSliderGrp -label (uiRes("m_performBirail.kProfileBlendValue")) -min 0 -max 1 -fmn 0 -fmx 1 birailBlendValueWidget; } separator; string $continuity = (uiRes("m_performBirail.kContinuity")); string $rebuild = (uiRes("m_performBirail.kRebuild")); string $profile = (uiRes("m_performBirail.kProfile")); string $firstProfile = (uiRes("m_performBirail.kFirstProfile")); string $secondProfile =(uiRes("m_performBirail.kSecondProfile")); string $lastProfile = (uiRes("m_performBirail.kLastProfile")); switch( $whichOne ) { case 1: checkBoxGrp -ncb 1 -label $continuity -label1 $profile birailContProfileWidget; checkBoxGrp -ncb 1 -label $rebuild -label1 $profile -cc1 ("birailVisibility " + $parent + " " + $whichOne + " -1") birailRebuildProfileWidget; break; case 2: checkBoxGrp -ncb 2 -label $continuity -label1 $firstProfile -label2 $secondProfile birailContProfileWidget; checkBoxGrp -ncb 2 -label $rebuild -label1 $firstProfile -label2 $secondProfile -cc1 ("birailVisibility " + $parent + " " + $whichOne + " -1") -cc2 ("birailVisibility " + $parent + " " + $whichOne + " -1") birailRebuildProfileWidget; break; case 3: default: checkBoxGrp -ncb 2 -label $continuity -label1 $firstProfile -label2 $lastProfile birailContProfileWidget; checkBoxGrp -ncb 2 -label $rebuild -label1 $firstProfile -label2 $lastProfile -cc1 ("birailVisibility " + $parent + " " + $whichOne + " -1") -cc2 ("birailVisibility " + $parent + " " + $whichOne + " -1") birailRebuildProfileWidget; break; } checkBoxGrp -ncb 2 -label "" -label1 (uiRes("m_performBirail.kFirstRail")) -label2 (uiRes("m_performBirail.kSecondRail")) -cc1 ("birailVisibility " + $parent + " " + $whichOne + " -1") -cc2 ("birailVisibility " + $parent + " " + $whichOne + " -1") birailRebuildRailWidget; separator; tabLayout -tabsVisible false rebuildOptions; string $par = `columnLayout rebuildOptionsOK`; rebuildCurveAddOptions $par 0; setParent ..; setParent ..; separator; string $outputGeometry = (uiRes("m_performBirail.kOutputGeometry")); string $nurbs = (uiRes("m_performBirail.kNurbs")); string $polygons = (uiRes("m_performBirail.kPolygons")); string $bezier = (uiRes("m_performBirail.kBezier")); if( `isTrue "SubdivUIExists"` ) { radioButtonGrp -nrb 4 -label $outputGeometry -label1 $nurbs -da1 0 -label2 $polygons -da2 1 -label3 (uiRes("m_performBirail.kSubdiv")) -da3 2 -label4 $bezier -da4 3 -cc1 "tabLayout -e -vis false polyOptions" // there are currently no NURBS options -cc2 "tabLayout -e -vis true polyOptions" -cc3 "tabLayout -e -vis false polyOptions" // there are currently no subdiv options -cc4 "tabLayout -e -vis false polyOptions" // there are currently no bezier options birailOutputPolyWidget; } else if( `isTrue "SurfaceUIExists"` ) { radioButtonGrp -nrb 2 -label $outputGeometry -label1 $nurbs -da1 0 -label2 $polygons -da2 1 -label3 $bezier -da3 2 -cc1 "tabLayout -e -vis false polyOptions" // there are currently no NURBS options -cc2 "tabLayout -e -vis true polyOptions" -cc3 "tabLayout -e -vis false polyOptions" // there are currently no bezier options birailOutputPolyWidget; } tabLayout -tabsVisible false polyOptions; $par = `columnLayout polyOptionsOK`; nurbsToPolyAddOptions $par; setParent ..; setParent ..; separator; checkBoxGrp -ncb 2 -label (uiRes("m_performBirail.kToolBehavior")) -label1 (uiRes("m_performBirail.kExitOnCompletion")) -v1 on -on1 ("scriptCtx -e -exitUponCompletion true " + $goToTool) -of1 ("scriptCtx -e -exitUponCompletion false " + $goToTool) -label2 (uiRes("m_performBirail.kAutoCompletion")) -v2 on -on2 ("scriptCtx -e -lac true " + $goToTool) -of2 ("scriptCtx -e -lac false " + $goToTool) scriptToolExtraWidget; // Turn off the wait cursor. // waitCursor -state 0; // Step 5: Deactivate the default UI template. // =========================================== // setUITemplate -popTemplate; // Step 6: Customize the buttons. // ============================== // 'Apply' button. // string $applyBtn = getOptionBoxApplyBtn(); string $whichOneString = string($whichOne); if( 3 == $whichOne ) { $whichOneString += "+"; } if( $inTheTool ) { string $buttonLabel = (uiRes("m_performBirail.kBirailTool")); $buttonLabel = `format -s $whichOneString $buttonLabel`; button -edit -label $buttonLabel -command ($callback + " " + $parent + " " + 3 + " " + $whichOne + " " + $goToTool ) $applyBtn; } else { button -edit -label (uiRes("m_performBirail.kBirail")) -command ($callback + " " + $parent + " " + 1 + " " + $whichOne + " " + $goToTool ) $applyBtn; } // 'Save' button. // string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + $parent + " " + 0 + " " + $whichOne + " " + $goToTool + "; hideOptionBox") $saveBtn; // 'Reset' button. // string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " " + 1 + " " + $whichOne + " " + $goToTool) $resetBtn; // Step 7: Set the option box title. // ================================= // $whichOneString = string($whichOne); if( 3 == $whichOne ) { $whichOneString += "+"; } string $title = (uiRes("m_performBirail.kBirailOptions")); $title = `format -s $whichOneString $title`; setOptionBoxTitle($title); // Step 8: Customize the 'Help' menu item text. // ============================================ // // The help tags for all birail tools go to the same place. // setOptionBoxHelpTag( "Birail1Tool" ); // Step 9: Set the current values of the option box. // ================================================= // eval (($setup + " " + $parent + " " + 0 + " " + $whichOne + " " + $goToTool)); // Step 10: Show the option box. // ============================= // showOptionBox(); } proc string birailHelp() { string $cmdHelp = "Command:- create a birail surface \n"; string $selectHelp = ("Selection: One or more profile curves followed " + "by the two rail curves along which to birail."); return $cmdHelp+$selectHelp; } global proc birailSetup( string $parent, int $forceFactorySettings, int $whichOne, string $goToTool ) { int $prop, $bfp, $blp, $rfp, $rlp; int $rfr, $rlr, $poly; float $bv; birailToolSetup( $forceFactorySettings, $goToTool ); // query all the option vars. // switch( $whichOne ) { case 1: setOptionVars1( $forceFactorySettings ); $prop = `optionVar -q birail1TransformProp`; $bfp = `optionVar -q birail1BlendFirstProfile`; $blp = 0; $bv = `optionVar -q birail1BlendValue`; $rfp = `optionVar -q birail1RebuildFirstProfile`; $rlp = `optionVar -q birail1RebuildLastProfile`; $rfr = `optionVar -q birail1RebuildFirstRail`; $rlr = `optionVar -q birail1RebuildLastRail`; $poly = `optionVar -q birail1OutputPoly`; break; case 2: setOptionVars2( $forceFactorySettings ); $prop = `optionVar -q birail2TransformProp`; $bfp = `optionVar -q birail2BlendFirstProfile`; $blp = `optionVar -q birail2BlendLastProfile`; $bv = `optionVar -q birail2BlendValue`; $rfp = `optionVar -q birail2RebuildFirstProfile`; $rlp = `optionVar -q birail2RebuildLastProfile`; $rfr = `optionVar -q birail2RebuildFirstRail`; $rlr = `optionVar -q birail2RebuildLastRail`; $poly = `optionVar -q birail2OutputPoly`; break; case 3: default: setOptionVars3( $forceFactorySettings ); $prop = `optionVar -q birail3TransformProp`; $bfp = `optionVar -q birail3BlendFirstProfile`; $blp = `optionVar -q birail3BlendLastProfile`; $bv = `optionVar -q birail3BlendValue`; $rfp = `optionVar -q birail3RebuildFirstProfile`; $rlp = `optionVar -q birail3RebuildLastProfile`; $rfr = `optionVar -q birail3RebuildFirstRail`; $rlr = `optionVar -q birail3RebuildLastRail`; $poly = `optionVar -q birail3OutputPoly`; break; } if( !`isTrue "SurfaceUIExists"` ) $poly = 1; setParent $parent; checkBoxGrp -e -v1 `scriptCtx -q -exitUponCompletion $goToTool` -v2 `scriptCtx -q -lac $goToTool` scriptToolExtraWidget; //set controls. // radioButtonGrp -e -select ($prop + 1) birailTransformPropWidget; if( 2 == $whichOne ) { floatSliderGrp -e -v $bv birailBlendValueWidget; } if( 1 == $whichOne ) { checkBoxGrp -e -v1 $bfp birailContProfileWidget; checkBoxGrp -e -v1 $rfp birailRebuildProfileWidget; } else { checkBoxGrp -e -v1 $bfp -v2 $blp birailContProfileWidget; checkBoxGrp -e -v1 $rfp -v2 $rlp birailRebuildProfileWidget; } checkBoxGrp -e -v1 $rfr -v2 $rlr birailRebuildRailWidget; if( `isTrue "SurfaceUIExists"` ) { if( (3 == $poly) && ! `isTrue "SubdivUIExists"` ) { $poly = 2; } radioButtonGrp -edit -select ($poly+1) birailOutputPolyWidget; } birailVisibility( $parent, $whichOne, ($rfp || $rlp || $rfr || $rlr)); rebuildCurveSetup( $parent, $forceFactorySettings ); switch( $poly ) { case 0: default: tabLayout -e -vis false polyOptions; // there are currently no NURBS options break; case 1: tabLayout -e -vis true polyOptions; break; case 2: tabLayout -e -vis false polyOptions; // there are currently no subdiv options break; } nurbsToPolySetup( $parent, $forceFactorySettings ); nurbsToSubdivSetup( $parent, $forceFactorySettings ); } global proc birailCallback( string $parent, int $doIt, int $whichOne, string $goToTool ) { if( "" != $goToTool ) { optionVar -iv birailEuc `scriptCtx -q -euc $goToTool`; optionVar -iv birailLac `scriptCtx -q -lac $goToTool`; } setParent $parent; // get Values from controls. // int $prop = `radioButtonGrp -q -select birailTransformPropWidget` - 1; int $bfp = `checkBoxGrp -q -v1 birailContProfileWidget`; int $blp = 0; if( 1 != $whichOne ) { $blp = `checkBoxGrp -q -v2 birailContProfileWidget`; } float $bv; if( 2 == $whichOne ) { $bv = `floatSliderGrp -q -v birailBlendValueWidget`; } int $rfp = `checkBoxGrp -q -v1 birailRebuildProfileWidget`; int $rlp = 0; if( 1 != $whichOne ) { $rlp = `checkBoxGrp -q -v2 birailRebuildProfileWidget`; } int $rfr = `checkBoxGrp -q -v1 birailRebuildRailWidget`; int $rlr = `checkBoxGrp -q -v2 birailRebuildRailWidget`; int $poly = 1; if( `isTrue "SurfaceUIExists"` ) { $poly = `radioButtonGrp -q -select birailOutputPolyWidget`; if( (3 == $poly) && ! `isTrue "SubdivUIExists"` ) { $poly = 4; } $poly = $poly - 1; } switch( $whichOne ) { case 1: optionVar -intValue birail1TransformProp $prop; optionVar -intValue birail1BlendFirstProfile $bfp; optionVar -floatValue birail1BlendValue $bv; optionVar -intValue birail1RebuildFirstProfile $rfp; optionVar -intValue birail1RebuildLastProfile $rlp; optionVar -intValue birail1RebuildFirstRail $rfr; optionVar -intValue birail1RebuildLastRail $rlr; if( `isTrue "SurfaceUIExists"` ) { optionVar -intValue birail1OutputPoly $poly; } break; case 2: optionVar -intValue birail2TransformProp $prop; optionVar -intValue birail2BlendFirstProfile $bfp; optionVar -intValue birail2BlendLastProfile $blp; optionVar -floatValue birail2BlendValue $bv; optionVar -intValue birail2RebuildFirstProfile $rfp; optionVar -intValue birail2RebuildLastProfile $rlp; optionVar -intValue birail2RebuildFirstRail $rfr; optionVar -intValue birail2RebuildLastRail $rlr; if( `isTrue "SurfaceUIExists"` ) { optionVar -intValue birail2OutputPoly $poly; } break; case 3: default: optionVar -intValue birail3TransformProp $prop; optionVar -intValue birail3BlendFirstProfile $bfp; optionVar -intValue birail3BlendLastProfile $blp; optionVar -floatValue birail3BlendValue $bv; optionVar -intValue birail3RebuildFirstProfile $rfp; optionVar -intValue birail3RebuildLastProfile $rlp; optionVar -intValue birail3RebuildFirstRail $rfr; optionVar -intValue birail3RebuildLastRail $rlr; if( `isTrue "SurfaceUIExists"` ) { optionVar -intValue birail3OutputPoly $poly; } break; } rebuildCurveCallback( $parent, 0, "" ); nurbsToPolyCallback( $parent, 0 ); nurbsToSubdivCallback( $parent, 0 ); if( 1 == $doIt ) { performBirail( 0, $whichOne, $goToTool ); string $tmpCmd = "performBirail(0, " + $whichOne + ", \"" + $goToTool + "\")"; addToRecentCommandQueue $tmpCmd "Birail"; } else { setToolTo $goToTool; } } global proc string performBirail( int $action, int $whichOne, string $goToTool ) // // Description : // $action = 0 ==> do the command. // $action = 1 ==>show option box. // $action = 2 ==>drag to shelf. { int $inTheTool = false; if( 3 == $action ) { $action = 1; $inTheTool = true; } string $cmd = ""; switch( $action ) { case 0 : // do the cmd. $cmd = `assembleCmd $whichOne`; eval $cmd; break; case 1 : // show option box. // birailOptions( $inTheTool, $whichOne, $goToTool ); break; case 2 : // drag to shelf the proc. // $cmd = `assembleCmd $whichOne`; break; default : break; } return $cmd; }