// =========================================================================== // 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: 4 April 1997 // // Procedure Name: // performPolyExtrudeVertex // // Description: // // // Input Arguments: // $option : Whether to set the options to default values. // Return Value: // command string iff $option==2 // proc setOptionVars ( int $forceFactorySettings ) { // -ew/-extrudeWidth if ($forceFactorySettings || !`optionVar -exists polyExtrudeVertexWidth`) optionVar -floatValue polyExtrudeVertexWidth 0.5; // -el/-extrudeLength if ($forceFactorySettings || !`optionVar -exists polyExtrudeVertexLength`) optionVar -floatValue polyExtrudeVertexLength 1.0; // -tx/-translateX -ty/-translateY -tz/-translateZ if ($forceFactorySettings || !`optionVar -exists "polyExtrudeVertexTranslate"`) optionVar -floatValue "polyExtrudeVertexTranslate" 0. -floatValueAppend "polyExtrudeVertexTranslate" 0. -floatValueAppend "polyExtrudeVertexTranslate" 0.; if ($forceFactorySettings || !`optionVar -exists "polyExtrudeVertexDivisions"`) optionVar -intValue polyExtrudeVertexDivisions 1; } global proc performPolyExtrudeVertexSetup (string $parent, int $forceFactorySettings) { float $vals[], $fval; int $ival; setOptionVars($forceFactorySettings); setParent $parent; $vals = `optionVar -query "polyExtrudeVertexTranslate"`; floatFieldGrp -edit -value1 $vals[0] -value2 $vals[1] -value3 $vals[2] polyExtrudeVertexTranslate; $fval = `optionVar -query polyExtrudeVertexWidth`; floatSliderGrp -edit -value $fval polyExtrudeVertexWidth; $fval = `optionVar -query polyExtrudeVertexLength`; floatSliderGrp -edit -value $fval polyExtrudeVertexLength; $ival=`optionVar -query polyExtrudeVertexDivisions`; intSliderGrp -edit -value $ival polyExtrudeVertexDivisions; } global proc performPolyExtrudeVertexCallback (string $parent, int $doIt) { setParent $parent; optionVar -floatValue "polyExtrudeVertexTranslate" `floatFieldGrp -query -value1 polyExtrudeVertexTranslate` -floatValueAppend "polyExtrudeVertexTranslate" `floatFieldGrp -query -value2 polyExtrudeVertexTranslate` -floatValueAppend "polyExtrudeVertexTranslate" `floatFieldGrp -query -value3 polyExtrudeVertexTranslate`; optionVar -floatValue polyExtrudeVertexWidth `floatSliderGrp -query -value polyExtrudeVertexWidth`; optionVar -floatValue polyExtrudeVertexLength `floatSliderGrp -query -value polyExtrudeVertexLength`; optionVar -intValue polyExtrudeVertexDivisions `intSliderGrp -query -value polyExtrudeVertexDivisions`; if ($doIt) { performPolyExtrudeVertex 0; addToRecentCommandQueue "performPolyExtrudeVertex 0" "PolyExtrudeVertex"; } } proc PolyExtrudeVertexOptions () { string $layout = getOptionBox(); setParent $layout; setUITemplate -pushTemplate DefaultTemplate; waitCursor -state 1; string $commandName = "performPolyExtrudeVertex"; string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); string $parent = `columnLayout -adjustableColumn 1`; floatFieldGrp -label (uiRes("m_performPolyExtrudeVertex.kMoveVertexWorld")) -numberOfFields 3 polyExtrudeVertexTranslate; floatFieldGrp -edit -vis off polyExtrudeVertexTranslate; floatSliderGrp -label (uiRes("m_performPolyExtrudeVertex.kWidth")) -minValue 0.0 -maxValue 0.5 polyExtrudeVertexWidth; floatSliderGrp -label (uiRes("m_performPolyExtrudeVertex.kLength")) -minValue -10.0 -maxValue 10.0 -fieldMinValue -1000.0 -fieldMaxValue 1000.0 polyExtrudeVertexLength; intSliderGrp -label (uiRes("m_performPolyExtrudeVertex.kDivisions")) -minValue 1 -maxValue 10 -fieldMinValue 1 -fieldMaxValue 100 polyExtrudeVertexDivisions; setParent -menu ..; waitCursor -state 0; setUITemplate -popTemplate; string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_performPolyExtrudeVertex.kExtrudeVertex")) -command ($callback + " " + $parent + " " + 1) $applyBtn; string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox") $saveBtn; string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " " + 1) $resetBtn; setOptionBoxTitle( (uiRes("m_performPolyExtrudeVertex.kOptions")) ); setOptionBoxHelpTag("ExtrudeVertices"); eval (($setup + " " + $parent + " " + 0)); showOptionBox(); } proc string assembleCmd() { setOptionVars (false); int $doHistory = `constructionHistory -q -toggle`; string $cmd=("polyExtrudeVertex -ch " + $doHistory); float $pc[]=`optionVar -query "polyExtrudeVertexTranslate"`; //$cmd+=(" -tx " + $pc[0] + " -ty " + $pc[1] + " -tz " + $pc[2]); float $fval; $fval = `optionVar -query polyExtrudeVertexWidth`; $cmd = ($cmd + " -w " + $fval); $fval = `optionVar -query polyExtrudeVertexLength`; $cmd = ($cmd + " -l " + $fval); int $divisions = `optionVar -query polyExtrudeVertexDivisions`; $cmd = ($cmd + " -d " + $divisions); return $cmd; } global proc string performPolyExtrudeVertex (int $option) { string $cmd=""; switch ($option) { case 0: $cmd=`assembleCmd `; string $res[]=`evalEcho $cmd`; break; break; case 1: PolyExtrudeVertexOptions(); break; case 2: $cmd="performPolyExtrudeVertex 0"; break; } return $cmd; }