-- mass object (all) edges chamfer: rollout massChamfer "Mass Chamfer 1.0" width:140 height:250 ( local chamferObjs = #() local selSet = 2 local chamAmount = 0.150 local chamSegs = 1 local chamOpen = off group "selection set" ( radiobuttons radSelSet labels:#("all objects", "selected objects") default:selSet align:#right enabled:true ) group "chamfer settings" ( spinner spnChamAmount "Amount" align:#right width:100 range:[0.000,20.00,chamAmount] scale: 0.05 type:#float spinner spnChamSegs "Segments" align:#right width:80 range:[0,20,chamSegs] type:#integer checkbox chBChamOpen "Open Chamfer" align:#right checked:false ) group "do/undo mass chamfer" ( progressBar myProgress value:0 color:green -- ] [ color: ] [ orient: ] button btnChamfer "Chamfer objects" tooltip:"do the chamfering" width:120 enabled:true button btnChamferUndo "Undo Chamfer" tooltip:"do the chamfering" width:120 enabled:false ) fn fnChamferObjs = ( tmpCounter = 0 -- if all objects: if selSet == 1 then ( tmpObjs = objects ) else ( tmpObjs = $selection ) for o in tmpObjs do ( if Superclassof o == Geometryclass and classof o != TargetObject do ( -- print (o.name as string) append chamferObjs o ) ) -- end for undo on ( for c in chamferObjs do ( myProgress.value = tmpCounter * 100 / chamferObjs.count tmpCounter += 1 addModifier c (Edit_Poly name:"EditPoly_customChamfer") clearSelection() select c subobjectLevel = 2 objEdges = $.modifiers["EditPoly_customChamfer"].GetNumEdges() $.modifiers["EditPoly_customChamfer"].Select #Edge #{1..objEdges} $.modifiers["EditPoly_customChamfer"].SetOperation #ChamferEdge $.modifiers["EditPoly_customChamfer"].chamferEdgeAmount = chamAmount $.modifiers["EditPoly_customChamfer"].edgeChamferSegments = chamSegs $.modifiers["EditPoly_customChamfer"].chamferEdgeOpen = chamOpen $.modifiers["EditPoly_customChamfer"].Commit () $.modifiers["EditPoly_customChamfer"].ButtonOp #ShrinkSelection subobjectLevel = 0 ) -- end for ) -- end undo myProgress.value = 0 -- select all modified objects select chamferObjs btnChamfer.enabled = false btnChamferUndo.enabled = true ) fn fnChamferObjsUndo = ( for c in chamferObjs do ( for m in c.modifiers do ( if (m.name=="EditPoly_customChamfer") do deleteModifier c m ) ) chamferObjs = #() btnChamfer.enabled = true btnChamferUndo.enabled = false ) -- end fn on radSelSet changed state do ( selSet = state if state==1 then ( messageBox ("ACHTUNG, Jung! Wirklich alle Objekte nehmen?") ) ) -- end on on spnChamAmount changed val do( chamAmount = val ) --end on on spnChamSegs changed val do( chamSegs = val ) --end on on chBChamOpen changed theState do( if theState == true then ( chamOpen = on ) else ( chamOpen = off ) ) on btnChamfer pressed do( fnChamferObjs() ) --end on on btnChamferUndo pressed do( fnChamferObjsUndo() ) --end on ) -- end rollout clearListener() createdialog massChamfer