[Path] PocketShape - fix improper path generation

Forum identification and discussion at https://forum.freecadweb.org/viewtopic.php?style=3&f=15&t=49513.
This commit is contained in:
Russell Johnson
2020-09-12 09:34:28 -05:00
parent d4519d5aec
commit fd3efcdbd7

View File

@@ -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))