Skip to content

Commit

Permalink
Path: Simplify and fix debugging code
Browse files Browse the repository at this point in the history
  • Loading branch information
Russ4262 committed Nov 22, 2020
1 parent a0d7ff2 commit 9f489b5
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/Mod/Path/PathScripts/PathSlot.py
Expand Up @@ -352,29 +352,27 @@ def opExecute(self, obj):
self.arcRadius = 0.0
self.newRadius = 0.0
self.isDebug = False if PathLog.getLevel(PathLog.thisModule()) != 4 else True
self.showDebugObjects = obj.ShowTempObjects
self.showDebugObjects = False
self.stockZMin = self.job.Stock.Shape.BoundBox.ZMin
CMDS = list()
FCAD = FreeCAD.ActiveDocument

try:
dotIdx = __name__.index('.') + 1
except Exception:
dotIdx = 0
self.module = __name__[dotIdx:]

if not self.isDebug:
self.showDebugObjects = False
# Setup debugging group for temp objects, when in DEBUG mode
if self.isDebug:
self.showDebugObjects = obj.ShowTempObjects
if self.showDebugObjects:
FCAD = FreeCAD.ActiveDocument
for grpNm in ['tmpDebugGrp', 'tmpDebugGrp001']:
if hasattr(FreeCAD.ActiveDocument, grpNm):
for go in FreeCAD.ActiveDocument.getObject(grpNm).Group:
FreeCAD.ActiveDocument.removeObject(go.Name)
FreeCAD.ActiveDocument.removeObject(grpNm)
self.tmpGrp = FreeCAD.ActiveDocument.addObject('App::DocumentObjectGroup', 'tmpDebugGrp')
tmpGrpNm = self.tmpGrp.Name

# self.updateEnumerations(obj)
if hasattr(FCAD, grpNm):
for go in FCAD.getObject(grpNm).Group:
FCAD.removeObject(go.Name)
FCAD.removeObject(grpNm)
self.tmpGrp = FCAD.addObject('App::DocumentObjectGroup', 'tmpDebugGrp')

# Begin GCode for operation with basic information
# ... and move cutter to clearance height and startpoint
Expand Down Expand Up @@ -412,8 +410,7 @@ def opExecute(self, obj):
# Hide the temporary objects
if self.showDebugObjects:
if FreeCAD.GuiUp:
import FreeCADGui
FreeCADGui.ActiveDocument.getObject(tmpGrpNm).Visibility = False
FreeCADGui.ActiveDocument.getObject(self.tmpGrp.Name).Visibility = False
self.tmpGrp.purgeTouched()

return True
Expand Down Expand Up @@ -592,6 +589,9 @@ def arcPass(PNTS, depth):
# Raise to SafeHeight when finished
CMDS.append(Path.Command('G0', {'Z': obj.SafeHeight.Value, 'F': self.vertRapid}))

if self.isDebug:
PathLog.debug('G-code arc command is: {}'.format(PATHS[path_index][2]))

return CMDS

def _finishLine(self, obj, pnts, featureCnt):
Expand Down Expand Up @@ -1679,7 +1679,7 @@ def _addDebugObject(self, objShape, objName):
do = FreeCAD.ActiveDocument.addObject('Part::Feature', 'tmp_' + objName)
do.Shape = objShape
do.purgeTouched()
self.tempGroup.addObject(do)
self.tmpGrp.addObject(do)
# Eclass


Expand Down

0 comments on commit 9f489b5

Please sign in to comment.