From fd3efcdbd7afd2ff2271e0029d3ec21870a3285f Mon Sep 17 00:00:00 2001 From: Russell Johnson <47639332+Russ4262@users.noreply.github.com> Date: Sat, 12 Sep 2020 09:34:28 -0500 Subject: [PATCH] [Path] PocketShape - fix improper path generation Forum identification and discussion at https://forum.freecadweb.org/viewtopic.php?style=3&f=15&t=49513. --- src/Mod/Path/PathScripts/PathPocketShape.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathPocketShape.py b/src/Mod/Path/PathScripts/PathPocketShape.py index 08b9729d27..a6352a63a2 100644 --- a/src/Mod/Path/PathScripts/PathPocketShape.py +++ b/src/Mod/Path/PathScripts/PathPocketShape.py @@ -665,7 +665,8 @@ class ObjectPocket(PathPocketBase.ObjectPocket): shpZMin = face.BoundBox.ZMin shpZMinVal = shpZMin PathLog.debug('self.horizontal pre-shpZMin: {}'.format(shpZMin)) - if self.isFaceUp(subBase, face) is False: + isFaceUp = self.isFaceUp(subBase, face) + if not isFaceUp: useAngle += 180.0 invZ = (-2 * shpZMin) - clrnc face.translate(FreeCAD.Vector(0.0, 0.0, invZ)) @@ -684,9 +685,16 @@ class ObjectPocket(PathPocketBase.ObjectPocket): PathLog.warning(msg + ' {} mm.'.format(start_dep)) PathLog.debug('LimitDepthToFace adj_final_dep: {}'.format(adj_final_dep)) else: - face.translate(FreeCAD.Vector(0, 0, obj.FinalDepth.Value - shpZMin)) + translation = obj.FinalDepth.Value - shpZMin + if not isFaceUp: + # Check if the `isFaceUp` returned correctly + zDestination = face.BoundBox.ZMin + translation + if (round(start_dep - obj.FinalDepth.Value, 6) != + round(start_dep - zDestination, 6)): + shpZMin = -1 * shpZMin + face.translate(FreeCAD.Vector(0, 0, translation)) - extent = FreeCAD.Vector(0, 0, start_dep - shpZMin + clrnc) # adj_final_dep + clrnc) + extent = FreeCAD.Vector(0, 0, abs(start_dep - shpZMin) + clrnc) # adj_final_dep + clrnc) extShp = face.removeSplitter().extrude(extent) self.removalshapes.append((extShp, False, 'pathPocketShape', useAngle, axis, start_dep, adj_final_dep)) PathLog.debug("Extent values are strDep: {}, finDep: {}, extrd: {}".format(start_dep, adj_final_dep, extent))