From c357cb77a129261cd05cee995653bcb17a857cdd Mon Sep 17 00:00:00 2001
From: Russell Johnson <47639332+Russ4262@users.noreply.github.com>
Date: Sat, 3 Oct 2020 14:00:55 -0500
Subject: [PATCH] Path: Remove null comments and improve debugging
Added method to create a FreeCAD object when in debug mode.
---
src/Mod/Path/PathScripts/PathPocketShape.py | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/Mod/Path/PathScripts/PathPocketShape.py b/src/Mod/Path/PathScripts/PathPocketShape.py
index 139b06d684..4bb5068d2d 100644
--- a/src/Mod/Path/PathScripts/PathPocketShape.py
+++ b/src/Mod/Path/PathScripts/PathPocketShape.py
@@ -321,6 +321,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
PathLog.track()
PathLog.debug("----- areaOpShapes() in PathPocketShape.py")
+ self.isDebug = True if PathLog.getLevel(PathLog.thisModule()) == 4 else False
baseSubsTuples = []
subCount = 0
allTuples = []
@@ -426,8 +427,6 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
msg += translate('Path', "\n
Bottom of pocket might be non-planar and/or not normal to spindle axis.")
msg += translate('Path', "\n
\n
3D pocket bottom is NOT available in this operation.")
PathLog.warning(msg)
- # title = translate('Path', 'Depth Warning')
- # self.guiMessage(title, msg, False)
else:
PathLog.error(translate("Path", "Failed to create a planar face from edges in {}.".format(sub)))
@@ -614,15 +613,11 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
if PathGeom.isRoughly(face.Area, 0):
msg = translate('PathPocket', 'Vertical faces do not form a loop - ignoring')
PathLog.error(msg)
- # title = translate("Path", "Face Selection Warning")
- # self.guiMessage(title, msg, True)
else:
face.translate(FreeCAD.Vector(0, 0, vFinDep - face.BoundBox.ZMin))
self.horiz.append(face)
msg = translate('Path', 'Verify final depth of pocket shaped by vertical faces.')
PathLog.warning(msg)
- # title = translate('Path', 'Depth Warning')
- # self.guiMessage(title, msg, False)
# add faces for extensions
self.exts = [] # pylint: disable=attribute-defined-outside-init
@@ -633,10 +628,6 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
self.horiz.append(face)
self.exts.append(face)
- # move all horizontal faces to FinalDepth
- # for f in self.horiz:
- # f.translate(FreeCAD.Vector(0, 0, obj.FinalDepth.Value - f.BoundBox.ZMin))
-
# check all faces and see if they are touching/overlapping and combine those into a compound
self.horizontal = [] # pylint: disable=attribute-defined-outside-init
for shape in PathGeom.combineConnectedShapes(self.horiz):
@@ -910,6 +901,13 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
return (go, norm, surf)
+ # Method to add temporary debug object
+ def _addDebugObject(self, objName, objShape):
+ if self.isDebug:
+ O = FreeCAD.ActiveDocument.addObject('Part::Feature', 'debug_' + objName)
+ O.Shape = objShape
+ O.purgeTouched()
+
def SetupProperties():
setup = PathPocketBase.SetupProperties()