From c75fc99cf6909ca19da5425e0f7879a3a083aba2 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Sun, 1 Jul 2018 00:17:36 -0700 Subject: [PATCH] Added chamfer selection guard to allow edges and faces. --- src/Mod/Path/PathScripts/PathSelection.py | 27 ++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/Mod/Path/PathScripts/PathSelection.py b/src/Mod/Path/PathScripts/PathSelection.py index 6d164a1deb..9b414cd2c6 100644 --- a/src/Mod/Path/PathScripts/PathSelection.py +++ b/src/Mod/Path/PathScripts/PathSelection.py @@ -64,6 +64,27 @@ class ENGRAVEGate: return False +class CHAMFERGate: + def allow(self, doc, obj, sub): + try: + shape = obj.Shape + except: + return False + + if math.fabs(shape.Volume) < 1e-9 and len(shape.Wires) > 0: + return True + + if 'Edge' == shape.ShapeType or 'Face' == shape.ShapeType: + return True + + if sub: + subShape = shape.getElement(sub) + if 'Edge' == subShape.ShapeType or 'Face' == subShape.ShapeType: + return True + + print(shape.ShapeType) + return False + class DRILLGate: def allow(self, doc, obj, sub): @@ -156,6 +177,10 @@ def engraveselect(): FreeCADGui.Selection.addSelectionGate(ENGRAVEGate()) FreeCAD.Console.PrintWarning("Engraving Select Mode\n") +def chamferselect(): + FreeCADGui.Selection.addSelectionGate(CHAMFERGate()) + FreeCAD.Console.PrintWarning("Chamfer Select Mode\n") + def profileselect(): FreeCADGui.Selection.addSelectionGate(PROFILEGate()) FreeCAD.Console.PrintWarning("Profiling Select Mode\n") @@ -170,7 +195,7 @@ def surfaceselect(): def select(op): opsel = {} - opsel['Chamfer'] = engraveselect + opsel['Chamfer'] = chamferselect opsel['Contour'] = contourselect opsel['Drilling'] = drillselect opsel['Engrave'] = engraveselect