// =========================================================================== // 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: 17 Sept 97 // // Procedure Name: // performPolyChamferVertex // // Description: // Chamfer the selected polygon vertices // // Input Arguments: // $option : Whether to set the options to default values. // Return Value: // command string iff $option==2 // proc setOptionVars (int $forceFactorySettings) { if ($forceFactorySettings || !`optionVar -exists polyChamferVertexWidth`) optionVar -floatValue polyChamferVertexWidth 0.25; if ($forceFactorySettings || !`optionVar -exists polyChamferVertexDeleteFace`) optionVar -intValue polyChamferVertexDeleteFace 0; } global proc performPolyChamferVertexSetup (string $parent, int $forceFactorySettings) { setOptionVars($forceFactorySettings); setParent $parent; float $fval = `optionVar -query polyChamferVertexWidth`; floatSliderGrp -edit -value $fval polyChamferVertexWidth; int $ival = `optionVar -query polyChamferVertexDeleteFace`; checkBoxGrp -edit -value1 $ival polyChamferVertexDeleteFace; } global proc performPolyChamferVertexCallback (string $parent, int $doIt) { setParent $parent; optionVar -floatValue polyChamferVertexWidth `floatSliderGrp -query -value polyChamferVertexWidth`; optionVar -intValue polyChamferVertexDeleteFace `checkBoxGrp -query -value1 polyChamferVertexDeleteFace`; if ($doIt) { performPolyChamferVertex 0; addToRecentCommandQueue "performPolyChamferVertex 0" "PolyChamferVertex"; } } proc polyChamferVertexOptions () { // Global template variables for form spacing global int $gOptionBoxTemplateDescriptionMarginWidth; global int $gOptionBoxTemplateFrameSpacing; string $commandName = "performPolyChamferVertex"; string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); string $layout = getOptionBox(); setParent $layout; setUITemplate -pushTemplate OptionBoxTemplate; waitCursor -state 1; // Form layout string $parent = `formLayout polyChamferVertexOptions`; // Description frame string $descriptionFrame = `frameLayout -label (uiRes("m_performPolyChamferVertex.kDescriptionFrame")) -mw $gOptionBoxTemplateDescriptionMarginWidth`; text (uiRes("m_performPolyChamferVertex.kDescription")); setParent $parent; // Settings frame string $settingsFrame = `frameLayout -label (uiRes("m_performPolyChamferVertex.kSettingsFrame"))`; columnLayout; floatSliderGrp -label (uiRes("m_performPolyChamferVertex.kWidth")) -min 0 -max 0.5 -fmx 0.5 polyChamferVertexWidth; checkBoxGrp -label1 (uiRes("m_performPolyChamferVertex.kRemoveFace")) polyChamferVertexDeleteFace; setParent $parent; setParent ..; // Attach Description/Settings frames to form layout formLayout -e -af $descriptionFrame "top" $gOptionBoxTemplateFrameSpacing -af $descriptionFrame "left" $gOptionBoxTemplateFrameSpacing -af $descriptionFrame "right" $gOptionBoxTemplateFrameSpacing -an $descriptionFrame "bottom" -ac $settingsFrame "top" $gOptionBoxTemplateFrameSpacing $descriptionFrame -af $settingsFrame "left" $gOptionBoxTemplateFrameSpacing -af $settingsFrame "right" $gOptionBoxTemplateFrameSpacing -an $settingsFrame "bottom" $parent; waitCursor -state 0; setUITemplate -popTemplate; string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_performPolyChamferVertex.kChamferVertexButton")) -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_performPolyChamferVertex.kChamferVertexOptions")) ); setOptionBoxHelpTag( "ChamferVertices" ); eval (($setup + " " + $parent + " " + 0)); showOptionBox(); } proc string assembleCmd() { setOptionVars(false); string $cmd; float $fval = `optionVar -query polyChamferVertexWidth`; int $ival = `optionVar -query polyChamferVertexDeleteFace`; int $doHistory = `constructionHistory -q -toggle`; $cmd = "polyChamferVtx " + $doHistory + " " + $fval + " " + $ival + ";"; return $cmd; } global proc string performPolyChamferVertex (int $option) { string $cmd=""; string $sel[]; switch ($option) { case 0: $cmd = assembleCmd(); select -add `evalEcho $cmd`; setToolTo ShowManips; break; case 1: polyChamferVertexOptions; break; default: $cmd = assembleCmd(); } return $cmd; }