From 239514e8259d2fbfa2fdf3fc1120fca9bb93e7cd Mon Sep 17 00:00:00 2001 From: sliptonic Date: Sun, 11 Jun 2017 14:25:51 -0500 Subject: [PATCH] Path: fix bug in drilling hemispherical faces have an odd edge that doesn't have a Curve attribute. --- src/Mod/Path/PathScripts/PathDrilling.py | 2 +- src/Mod/Path/PathScripts/PathPocket.py | 11 ++++++++--- src/Mod/Path/PathScripts/PathProfile.py | 22 ++++++++++------------ 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathDrilling.py b/src/Mod/Path/PathScripts/PathDrilling.py index 9648b23862..56c6433708 100644 --- a/src/Mod/Path/PathScripts/PathDrilling.py +++ b/src/Mod/Path/PathScripts/PathDrilling.py @@ -39,7 +39,7 @@ if sys.version_info.major >= 3: LOG_MODULE = 'PathDrilling' PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE) -PathLog.trackModule('PathDrilling') +#PathLog.trackModule('PathDrilling') FreeCADGui = None if FreeCAD.GuiUp: diff --git a/src/Mod/Path/PathScripts/PathPocket.py b/src/Mod/Path/PathScripts/PathPocket.py index 358bec96bc..f891d564ee 100644 --- a/src/Mod/Path/PathScripts/PathPocket.py +++ b/src/Mod/Path/PathScripts/PathPocket.py @@ -38,7 +38,7 @@ if FreeCAD.GuiUp: LOG_MODULE = 'PathPocket' PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE) -#PathLog.trackModule('PathPocket') +PathLog.trackModule('PathPocket') FreeCAD.setLogLevel('Path.Area', 0) @@ -172,7 +172,7 @@ class ObjectPocket: stepover = (self.radius * 2) * (float(obj.StepOver)/100) - pocketparams = {'Fill': 0, + pocketparams = {'Fill': 2, 'Coplanar': 0, 'PocketMode': 1, 'SectionCount': -1, @@ -249,12 +249,17 @@ class ObjectPocket: PathLog.debug("Base item: {}".format(b)) for sub in b[1]: if "Face" in sub: - shape = getattr(b[0].Shape, sub) + shape = Part.makeCompound([getattr(b[0].Shape, sub)]) + #shape = getattr(b[0].Shape, sub) else: edges = [getattr(b[0].Shape, sub) for sub in b[1]] shape = Part.makeFace(edges, 'Part::FaceMakerSimple') env = PathUtils.getEnvelope(baseobject.Shape, subshape=shape, stockheight=obj.StartDepth) + if PathLog.getLevel(PathLog.thisModule()) == PathLog.Level.DEBUG: + removalshape=FreeCAD.ActiveDocument.addObject("Part::Feature","removalshape") + removalshape.Shape = env.cut(baseobject.Shape) + try: commandlist.extend(self._buildPathArea(obj, env.cut(baseobject.Shape)).Commands) except Exception as e: diff --git a/src/Mod/Path/PathScripts/PathProfile.py b/src/Mod/Path/PathScripts/PathProfile.py index 215264e2ba..d45f284814 100644 --- a/src/Mod/Path/PathScripts/PathProfile.py +++ b/src/Mod/Path/PathScripts/PathProfile.py @@ -260,18 +260,16 @@ class ObjectProfile: FreeCAD.Console.PrintWarning ("found a base object which is not a face. Can't continue.") return - if obj.processHoles: - for wire in holes: - f = Part.makeFace(wire, 'Part::FaceMakerSimple') - drillable = PathUtils.isDrillable(baseobject.Shape, wire) - if (drillable and obj.processCircles) or (not drillable and obj.processHoles): - - env = PathUtils.getEnvelope(baseobject.Shape, subshape=f, stockheight=obj.StartDepth) - try: - commandlist.extend(self._buildPathArea(obj, baseobject=env, isHole=True, start=None).Commands) - except Exception as e: - FreeCAD.Console.PrintError(e) - FreeCAD.Console.PrintError("Something unexpected happened. Unable to generate a contour path. Check project and tool config.") + for wire in holes: + f = Part.makeFace(wire, 'Part::FaceMakerSimple') + drillable = PathUtils.isDrillable(baseobject.Shape, wire) + if (drillable and obj.processCircles) or (not drillable and obj.processHoles): + env = PathUtils.getEnvelope(baseobject.Shape, subshape=f, stockheight=obj.StartDepth) + try: + commandlist.extend(self._buildPathArea(obj, baseobject=env, isHole=True, start=None).Commands) + except Exception as e: + FreeCAD.Console.PrintError(e) + FreeCAD.Console.PrintError("Something unexpected happened. Unable to generate a contour path. Check project and tool config.") if len(faces) > 0: profileshape = Part.makeCompound(faces)