From edd46bc7d0779b1fbb9e9a02c3cb9e5e4dc10327 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Tue, 31 Dec 2019 18:12:44 -0800 Subject: [PATCH 01/11] Deletion of dogbone dressup should not rely on the model being properly setup. --- src/Mod/Path/PathScripts/PathDressupDogbone.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathDressupDogbone.py b/src/Mod/Path/PathScripts/PathDressupDogbone.py index 66f9930cdd..ef21c277a1 100644 --- a/src/Mod/Path/PathScripts/PathDressupDogbone.py +++ b/src/Mod/Path/PathScripts/PathDressupDogbone.py @@ -1051,10 +1051,12 @@ class ViewProviderDressup: def onDelete(self, arg1=None, arg2=None): '''this makes sure that the base operation is added back to the project and visible''' # pylint: disable=unused-argument - FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True - job = PathUtils.findParentJob(arg1.Object) - job.Proxy.addOperation(arg1.Object.Base, arg1.Object) - arg1.Object.Base = None + if arg1.Object and arg1.Object.Base: + FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True + job = PathUtils.findParentJob(arg1.Object) + if job: + job.Proxy.addOperation(arg1.Object.Base, arg1.Object) + arg1.Object.Base = None return True From a0d7174a3df6371e99573f1af0e7336cd0a9600a Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Tue, 31 Dec 2019 18:21:39 -0800 Subject: [PATCH 02/11] Allow deletion of dressup even if model is not setup correctly. --- src/Mod/Path/PathScripts/PathDressupAxisMap.py | 10 ++++++---- src/Mod/Path/PathScripts/PathDressupDragknife.py | 10 ++++++---- src/Mod/Path/PathScripts/PathDressupLeadInOut.py | 10 ++++++---- src/Mod/Path/PathScripts/PathDressupPathBoundary.py | 3 ++- src/Mod/Path/PathScripts/PathDressupPathBoundaryGui.py | 3 ++- src/Mod/Path/PathScripts/PathDressupRampEntry.py | 10 ++++++---- src/Mod/Path/PathScripts/PathDressupTagGui.py | 5 +++-- 7 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathDressupAxisMap.py b/src/Mod/Path/PathScripts/PathDressupAxisMap.py index ffcbf4f0ae..472300a496 100644 --- a/src/Mod/Path/PathScripts/PathDressupAxisMap.py +++ b/src/Mod/Path/PathScripts/PathDressupAxisMap.py @@ -168,10 +168,12 @@ class ViewProviderDressup: def onDelete(self, arg1=None, arg2=None): '''this makes sure that the base operation is added back to the project and visible''' # pylint: disable=unused-argument - FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True - job = PathUtils.findParentJob(arg1.Object) - job.Proxy.addOperation(arg1.Object.Base, arg1.Object) - arg1.Object.Base = None + if arg1.Object and arg1.Object.Base: + FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True + job = PathUtils.findParentJob(arg1.Object) + if job: + job.Proxy.addOperation(arg1.Object.Base, arg1.Object) + arg1.Object.Base = None return True class CommandPathDressup: diff --git a/src/Mod/Path/PathScripts/PathDressupDragknife.py b/src/Mod/Path/PathScripts/PathDressupDragknife.py index b1f0cb0039..927c07fc44 100644 --- a/src/Mod/Path/PathScripts/PathDressupDragknife.py +++ b/src/Mod/Path/PathScripts/PathDressupDragknife.py @@ -465,10 +465,12 @@ class ViewProviderDressup: def onDelete(self, arg1=None, arg2=None): # pylint: disable=unused-argument - FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True - job = PathUtils.findParentJob(arg1.Object.Base) - job.Proxy.addOperation(arg1.Object.Base, arg1.Object) - arg1.Object.Base = None + if arg1.Object and arg1.Object.Base: + FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True + job = PathUtils.findParentJob(arg1.Object.Base) + if job: + job.Proxy.addOperation(arg1.Object.Base, arg1.Object) + arg1.Object.Base = None return True diff --git a/src/Mod/Path/PathScripts/PathDressupLeadInOut.py b/src/Mod/Path/PathScripts/PathDressupLeadInOut.py index e3e3551765..4ab56d5b37 100644 --- a/src/Mod/Path/PathScripts/PathDressupLeadInOut.py +++ b/src/Mod/Path/PathScripts/PathDressupLeadInOut.py @@ -322,10 +322,12 @@ class ViewProviderDressup: '''this makes sure that the base operation is added back to the project and visible''' # pylint: disable=unused-argument PathLog.debug("Deleting Dressup") - FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True - job = PathUtils.findParentJob(self.obj) - job.Proxy.addOperation(arg1.Object.Base, arg1.Object) - arg1.Object.Base = None + if arg1.Object and arg1.Object.Base: + FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True + job = PathUtils.findParentJob(self.obj) + if job: + job.Proxy.addOperation(arg1.Object.Base, arg1.Object) + arg1.Object.Base = None return True def __getstate__(self): diff --git a/src/Mod/Path/PathScripts/PathDressupPathBoundary.py b/src/Mod/Path/PathScripts/PathDressupPathBoundary.py index f948aea975..34029fede8 100644 --- a/src/Mod/Path/PathScripts/PathDressupPathBoundary.py +++ b/src/Mod/Path/PathScripts/PathDressupPathBoundary.py @@ -66,7 +66,8 @@ class DressupPathBoundary(object): def onDelete(self, obj, args): if obj.Base: job = PathUtils.findParentJob(obj) - job.Proxy.addOperation(obj.Base, obj) + if job: + job.Proxy.addOperation(obj.Base, obj) if obj.Base.ViewObject: obj.Base.ViewObject.Visibility = True obj.Base = None diff --git a/src/Mod/Path/PathScripts/PathDressupPathBoundaryGui.py b/src/Mod/Path/PathScripts/PathDressupPathBoundaryGui.py index afa6fabcc7..072c567c63 100644 --- a/src/Mod/Path/PathScripts/PathDressupPathBoundaryGui.py +++ b/src/Mod/Path/PathScripts/PathDressupPathBoundaryGui.py @@ -191,7 +191,8 @@ class DressupPathBoundaryViewProvider(object): return [self.obj.Base, self.obj.Stock] def onDelete(self, vobj, args=None): - vobj.Object.Proxy.onDelete(vobj.Object, args) + if vobj.Object and vobj.Object.Proxy: + vobj.Object.Proxy.onDelete(vobj.Object, args) return True def setEdit(self, vobj, mode=0): diff --git a/src/Mod/Path/PathScripts/PathDressupRampEntry.py b/src/Mod/Path/PathScripts/PathDressupRampEntry.py index fa55135b2e..8360dae41b 100644 --- a/src/Mod/Path/PathScripts/PathDressupRampEntry.py +++ b/src/Mod/Path/PathScripts/PathDressupRampEntry.py @@ -654,10 +654,12 @@ class ViewProviderDressup: '''this makes sure that the base operation is added back to the project and visible''' # pylint: disable=unused-argument PathLog.debug("Deleting Dressup") - FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True - job = PathUtils.findParentJob(self.obj) - job.Proxy.addOperation(arg1.Object.Base, arg1.Object) - arg1.Object.Base = None + if arg1.Object and arg1.Object.Base: + FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True + job = PathUtils.findParentJob(self.obj) + if job: + job.Proxy.addOperation(arg1.Object.Base, arg1.Object) + arg1.Object.Base = None return True def __getstate__(self): diff --git a/src/Mod/Path/PathScripts/PathDressupTagGui.py b/src/Mod/Path/PathScripts/PathDressupTagGui.py index bc87bed323..9f24f1b9c7 100644 --- a/src/Mod/Path/PathScripts/PathDressupTagGui.py +++ b/src/Mod/Path/PathScripts/PathDressupTagGui.py @@ -422,8 +422,9 @@ class PathDressupTagViewProvider: if self.obj.Base.ViewObject: self.obj.Base.ViewObject.Visibility = True job = PathUtils.findParentJob(self.obj) - job.Proxy.addOperation(arg1.Object.Base, arg1.Object) - arg1.Object.Base = None + if arg1.Object and arg1.Object.Base and job: + job.Proxy.addOperation(arg1.Object.Base, arg1.Object) + arg1.Object.Base = None # if self.debugDisplay(): # self.vobj.Debug.removeObjectsFromDocument() # self.vobj.Debug.Document.removeObject(self.vobj.Debug.Name) From 4d88018edfd981fe434790b9133d0f262a986552 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Wed, 1 Jan 2020 15:42:35 -0800 Subject: [PATCH 03/11] Sorting edges before making a wire is required for all edges to be included, issue #4219 --- src/Mod/Path/PathScripts/PathPocketShape.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathPocketShape.py b/src/Mod/Path/PathScripts/PathPocketShape.py index bf942888d5..e4bb360559 100644 --- a/src/Mod/Path/PathScripts/PathPocketShape.py +++ b/src/Mod/Path/PathScripts/PathPocketShape.py @@ -43,13 +43,8 @@ __created__ = "2017" __scriptVersion__ = "2i usable" __lastModified__ = "2019-09-07 08:32 CST" -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) # Qt translation handling @@ -122,6 +117,7 @@ class Extension(object): DirectionY = 2 def __init__(self, obj, feature, sub, length, direction): + PathLog.debug("Extension(%s, %s, %s, %.2f, %s" % (obj.Label, feature, sub, length, direction)) self.obj = obj self.feature = feature self.sub = sub @@ -149,8 +145,11 @@ class Extension(object): def _getEdgeNumbers(self): if 'Wire' in self.sub: - return [nr for nr in self.sub[5:-1].split(',')] - return [self.sub[4:]] + numbers = [nr for nr in self.sub[5:-1].split(',')] + else: + numbers = [self.sub[4:]] + PathLog.debug("_getEdgeNumbers() -> %s" % numbers) + return numbers def _getEdgeNames(self): return ["Edge%s" % nr for nr in self._getEdgeNumbers()] @@ -180,13 +179,15 @@ class Extension(object): def getWire(self): PathLog.track() if PathGeom.isRoughly(0, self.length.Value) or not self.sub: + PathLog.debug("no extension, length=%.2f, sub=%s" % (self.length.Value, self.sub)) return None feature = self.obj.Shape.getElement(self.feature) edges = self._getEdges() - sub = Part.Wire(edges) + sub = Part.Wire(Part.sortEdges(edges)[0]) if 1 == len(edges): + PathLog.debug("Extending single edge wire") edge = edges[0] if Part.Circle == type(edge.Curve) and not endPoints(edge): circle = edge.Curve From f7527927c6480c41140245b348b9de2bf02ff4fa Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Thu, 2 Jan 2020 12:08:34 -0800 Subject: [PATCH 04/11] Enable loop detection if it /could/ succeed but don't actually calculate it until activated. --- src/Mod/Path/PathCommands.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Mod/Path/PathCommands.py b/src/Mod/Path/PathCommands.py index 400072e429..64b37604ef 100644 --- a/src/Mod/Path/PathCommands.py +++ b/src/Mod/Path/PathCommands.py @@ -35,6 +35,7 @@ from PathScripts.PathUtils import findParentJob if FreeCAD.GuiUp: import FreeCADGui from PySide import QtCore + from PySide import QtGui else: def translate(ctxt, txt): return txt @@ -68,7 +69,8 @@ class _CommandSelectLoop: self.obj = sel.Object self.sub = sel.SubElementNames if sel.SubObjects: - self.active = self.formsPartOfALoop(sel.Object, sel.SubObjects[0], sel.SubElementNames) + #self.active = self.formsPartOfALoop(sel.Object, sel.SubObjects[0], sel.SubElementNames) + self.active = True else: self.active = False return self.active @@ -102,6 +104,10 @@ class _CommandSelectLoop: for i in loopwire.Edges: if e.hashCode() == i.hashCode(): FreeCADGui.Selection.addSelection(obj, "Edge" + str(elist.index(e) + 1)) + elif FreeCAD.GuiUp: + QtGui.QMessageBox.information(None, + QtCore.QT_TRANSLATE_NOOP('Path_SelectLoop', 'Feature Completion'), + QtCore.QT_TRANSLATE_NOOP('Path_SelectLoop', 'Closed loop detection failed.')) def formsPartOfALoop(self, obj, sub, names): try: From b8e92ba9587c8cf9fad730e916dee8c9c4c85307 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Thu, 2 Jan 2020 21:20:51 -0800 Subject: [PATCH 05/11] Fixed segfault if some extensions end up being not valid. --- .../Path/PathScripts/PathPocketShapeGui.py | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathPocketShapeGui.py b/src/Mod/Path/PathScripts/PathPocketShapeGui.py index 0ce7d2575f..c498e64750 100644 --- a/src/Mod/Path/PathScripts/PathPocketShapeGui.py +++ b/src/Mod/Path/PathScripts/PathPocketShapeGui.py @@ -43,13 +43,8 @@ __doc__ = "Pocket Shape operation page controller and command implementation." def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) class _Extension(object): ColourEnabled = (1.0, .5, 1.0) @@ -119,10 +114,12 @@ class _Extension(object): return not self.root is None def show(self): - self.switch.whichChild = coin.SO_SWITCH_ALL + if self.switch: + self.switch.whichChild = coin.SO_SWITCH_ALL def hide(self): - self.switch.whichChild = coin.SO_SWITCH_NONE + if self.switch: + self.switch.whichChild = coin.SO_SWITCH_NONE def enable(self, ena = True): if ena: @@ -231,7 +228,7 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage): self.setExtensions(self.extensions) def createItemForBaseModel(self, base, sub, edges, extensions): - PathLog.track() + PathLog.track(base.Label, sub, '+', len(edges), len(base.Shape.getElement(sub).Edges)) ext = _Extension(self.obj, base, sub, None) item = QtGui.QStandardItem() item.setData(sub, QtCore.Qt.EditRole) @@ -241,17 +238,18 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage): extendCorners = self.form.extendCorners.isChecked() def createSubItem(label, ext0): - self.switch.addChild(ext0.root) - item0 = QtGui.QStandardItem() - item0.setData(label, QtCore.Qt.EditRole) - item0.setData(ext0, self.DataObject) - item0.setCheckable(True) - for e in extensions: - if e.obj == base and e.sub == label: - item0.setCheckState(QtCore.Qt.Checked) - ext0.enable() - break - item.appendRow([item0]) + if ext0.root: + self.switch.addChild(ext0.root) + item0 = QtGui.QStandardItem() + item0.setData(label, QtCore.Qt.EditRole) + item0.setData(ext0, self.DataObject) + item0.setCheckable(True) + for e in extensions: + if e.obj == base and e.sub == label: + item0.setCheckState(QtCore.Qt.Checked) + ext0.enable() + break + item.appendRow([item0]) extensionEdges = {} for edge in base.Shape.getElement(sub).Edges: @@ -305,7 +303,8 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage): def removeItemSwitch(item, ext): # pylint: disable=unused-argument ext.hide() - self.switch.removeChild(ext.root) + if ext.root: + self.switch.removeChild(ext.root) self.forAllItemsCall(removeItemSwitch) self.model.clear() From a33af45aa2e81eb872a153b613b98ed5d77a99c6 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Thu, 2 Jan 2020 21:26:37 -0800 Subject: [PATCH 06/11] Fixed extension generation for arcs if the length is larger than the arc radius and the direction is an inset. --- src/Mod/Path/PathScripts/PathPocketShape.py | 62 +++++++++++++-------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathPocketShape.py b/src/Mod/Path/PathScripts/PathPocketShape.py index e4bb360559..5739ceb8bb 100644 --- a/src/Mod/Path/PathScripts/PathPocketShape.py +++ b/src/Mod/Path/PathScripts/PathPocketShape.py @@ -92,24 +92,29 @@ def selectOffsetWire(feature, wires): def extendWire(feature, wire, length): '''extendWire(wire, length) ... return a closed Wire which extends wire by length''' - off2D = wire.makeOffset2D(length) - endPts = endPoints(wire) - edges = [e for e in off2D.Edges if Part.Circle != type(e.Curve) or not includesPoint(e.Curve.Center, endPts)] - wires = [Part.Wire(e) for e in Part.sortEdges(edges)] - offset = selectOffsetWire(feature, wires) - ePts = endPoints(offset) - l0 = (ePts[0] - endPts[0]).Length - l1 = (ePts[1] - endPts[0]).Length - edges = wire.Edges - if l0 < l1: - edges.append(Part.Edge(Part.LineSegment(endPts[0], ePts[0]))) - edges.extend(offset.Edges) - edges.append(Part.Edge(Part.LineSegment(endPts[1], ePts[1]))) - else: - edges.append(Part.Edge(Part.LineSegment(endPts[1], ePts[0]))) - edges.extend(offset.Edges) - edges.append(Part.Edge(Part.LineSegment(endPts[0], ePts[1]))) - return Part.Wire(edges) + PathLog.track(length) + if length and length != 0: + off2D = wire.makeOffset2D(length) + endPts = endPoints(wire) + if endPts: + edges = [e for e in off2D.Edges if Part.Circle != type(e.Curve) or not includesPoint(e.Curve.Center, endPts)] + wires = [Part.Wire(e) for e in Part.sortEdges(edges)] + offset = selectOffsetWire(feature, wires) + ePts = endPoints(offset) + if ePts and len(ePts) > 1: + l0 = (ePts[0] - endPts[0]).Length + l1 = (ePts[1] - endPts[0]).Length + edges = wire.Edges + if l0 < l1: + edges.append(Part.Edge(Part.LineSegment(endPts[0], ePts[0]))) + edges.extend(offset.Edges) + edges.append(Part.Edge(Part.LineSegment(endPts[1], ePts[1]))) + else: + edges.append(Part.Edge(Part.LineSegment(endPts[1], ePts[0]))) + edges.extend(offset.Edges) + edges.append(Part.Edge(Part.LineSegment(endPts[0], ePts[1]))) + return Part.Wire(edges) + return None class Extension(object): DirectionNormal = 0 @@ -189,24 +194,37 @@ class Extension(object): if 1 == len(edges): PathLog.debug("Extending single edge wire") edge = edges[0] - if Part.Circle == type(edge.Curve) and not endPoints(edge): + if Part.Circle == type(edge.Curve): circle = edge.Curve # for a circle we have to figure out if it's a hole or a cylinder p0 = edge.valueAt(edge.FirstParameter) normal = (edge.Curve.Center - p0).normalize() direction = self._getDirectedNormal(p0, normal) - if direction is None: return None + if PathGeom.pointsCoincide(normal, direction): r = circle.Radius - self.length.Value else: r = circle.Radius + self.length.Value # assuming the offset produces a valid circle - go for it if r > 0: - c1 = Part.makeCircle(r, circle.Center, circle.Axis, edge.FirstParameter * 180 / math.pi, edge.LastParameter * 180 / math.pi) - return [Part.Wire([edge]), Part.Wire([c1])] + e3 = Part.makeCircle(r, circle.Center, circle.Axis, edge.FirstParameter * 180 / math.pi, edge.LastParameter * 180 / math.pi) + if endPoints(edge): + # need to construct the arc slice + e0 = Part.makeLine(edge.valueAt(edge.FirstParameter), e3.valueAt(e3.FirstParameter)) + e2 = Part.makeLine(edge.valueAt(edge.LastParameter), e3.valueAt(e3.LastParameter)) + return Part.Wire([e0, edge, e2, e3]) + return Part.Wire([e3]) # the extension is bigger than the hole - so let's just cover the whole hole + if endPoints(edge): + # if the resulting arc is smaller than the radius, create a pie slice + PathLog.track() + center = circle.Center + e0 = Part.makeLine(center, edge.valueAt(edge.FirstParameter)) + e2 = Part.makeLine(edge.valueAt(edge.LastParameter), center) + return Part.Wire([e0, edge, e2]) + PathLog.track() return Part.Wire([edge]) else: From 06007c6bbed97b4d2c512b803cadca1f56ead486 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Fri, 3 Jan 2020 16:42:33 -0800 Subject: [PATCH 07/11] Fixed engraving support for generic b-spline curves --- src/Mod/Path/PathScripts/PathGeom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Path/PathScripts/PathGeom.py b/src/Mod/Path/PathScripts/PathGeom.py index 335f42fe8b..8cf7bff715 100644 --- a/src/Mod/Path/PathScripts/PathGeom.py +++ b/src/Mod/Path/PathScripts/PathGeom.py @@ -255,7 +255,7 @@ def cmdsForEdge(edge, flip = False, useHelixForBSpline = True, segm = 50, hSpeed p2 = edge.valueAt((edge.FirstParameter + edge.LastParameter)/2) p3 = pt - if (type(edge.Curve) == Part.Circle and isRoughly(edge.Curve.Axis.x, 0) and isRoughly(edge.Curve.Axis.y, 0)) or (useHelixForBSpline and type(edge.Curve) == Part.BSplineCurve): + if hasattr(edge.Curve, 'Axis') and ((type(edge.Curve) == Part.Circle and isRoughly(edge.Curve.Axis.x, 0) and isRoughly(edge.Curve.Axis.y, 0)) or (useHelixForBSpline and type(edge.Curve) == Part.BSplineCurve)): # This is an arc or a helix and it should be represented by a simple G2/G3 command if edge.Curve.Axis.z < 0: cmd = 'G2' if not flip else 'G3' From af451929165a52a30a14ce28fec1144de8dd4ae0 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Fri, 3 Jan 2020 18:56:06 -0800 Subject: [PATCH 08/11] Added support for flipping a BezierCurve edge --- src/Mod/Path/PathScripts/PathEngrave.py | 13 +++++-------- src/Mod/Path/PathScripts/PathGeom.py | 18 +++++++++--------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathEngrave.py b/src/Mod/Path/PathScripts/PathEngrave.py index b10662ae38..1083377a50 100644 --- a/src/Mod/Path/PathScripts/PathEngrave.py +++ b/src/Mod/Path/PathScripts/PathEngrave.py @@ -35,13 +35,8 @@ from PySide import QtCore __doc__ = "Class and implementation of Path Engrave operation" -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) +PathLog.trackModule(PathLog.thisModule()) # Qt translation handling @@ -84,6 +79,7 @@ class ObjectEngrave(PathEngraveBase.ObjectOp): jobshapes = [] if len(obj.Base) >= 1: # user has selected specific subelements + PathLog.track(len(obj.Base)) wires = [] for base, subs in obj.Base: edges = [] @@ -104,6 +100,7 @@ class ObjectEngrave(PathEngraveBase.ObjectOp): jobshapes.append(Part.makeCompound(wires)) else: # Use the Job Base object + PathLog.track(self.model) for base in self.model: PathLog.track(base.Label) if base.isDerivedFrom('Part::Part2DObject'): @@ -121,7 +118,6 @@ class ObjectEngrave(PathEngraveBase.ObjectOp): if len(jobshapes) > 0: PathLog.debug('processing {} jobshapes'.format(len(jobshapes))) - PathLog.track() wires = [] for shape in jobshapes: PathLog.debug('jobshape has {} edges'.format(len(shape.Edges))) @@ -130,6 +126,7 @@ class ObjectEngrave(PathEngraveBase.ObjectOp): self.buildpathocc(obj, shape.Wires, self.getZValues(obj)) wires.extend(shapeWires) self.wires = wires + PathLog.debug('processing {} jobshapes -> {} wires'.format(len(jobshapes), len(wires))) # the last command is a move to clearance, which is automatically added by PathOp if self.commandlist: self.commandlist.pop() diff --git a/src/Mod/Path/PathScripts/PathGeom.py b/src/Mod/Path/PathScripts/PathGeom.py index 8cf7bff715..ae26c53b5a 100644 --- a/src/Mod/Path/PathScripts/PathGeom.py +++ b/src/Mod/Path/PathScripts/PathGeom.py @@ -38,13 +38,8 @@ __doc__ = "Functions to extract and convert between Path.Command and Part.Edge a Tolerance = 0.000001 -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) +PathLog.trackModule(PathLog.thisModule()) # Qt translation handling def translate(context, text, disambig=None): @@ -523,8 +518,11 @@ def flipEdge(edge): # Now the edge always starts at 0 and LastParameter is the value range arc = Part.Edge(circle, 0, edge.LastParameter - edge.FirstParameter) return arc - elif Part.BSplineCurve == type(edge.Curve): - spline = edge.Curve + elif type(edge.Curve) in [Part.BSplineCurve, Part.BezierCurve]: + if type(edge.Curve) == Part.BSplineCurve: + spline = edge.Curve + else: + spline = edge.Curve.toBSpline() mults = spline.getMultiplicities() weights = spline.getWeights() @@ -556,4 +554,6 @@ def flipWire(wire): '''Flip the entire wire and all its edges so it is being processed the other way around.''' edges = [flipEdge(e) for e in wire.Edges] edges.reverse() + PathLog.debug(edges) return Part.Wire(edges) + From 80e57ebcc7e87f6301bd7ed17309c9bb35f212ae Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Fri, 3 Jan 2020 20:00:44 -0800 Subject: [PATCH 09/11] Added support for BaseShapes back into Engrave op --- src/Mod/Path/PathScripts/PathEngrave.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathEngrave.py b/src/Mod/Path/PathScripts/PathEngrave.py index 1083377a50..034a19cf59 100644 --- a/src/Mod/Path/PathScripts/PathEngrave.py +++ b/src/Mod/Path/PathScripts/PathEngrave.py @@ -99,7 +99,9 @@ class ObjectEngrave(PathEngraveBase.ObjectOp): wires.extend(basewires) jobshapes.append(Part.makeCompound(wires)) - else: # Use the Job Base object + elif len(obj.BaseShapes) > 0: # user added specific shapes + jobshapes.extend([base.Shape for base in obj.BaseShapes]) + else: PathLog.track(self.model) for base in self.model: PathLog.track(base.Label) @@ -120,10 +122,10 @@ class ObjectEngrave(PathEngraveBase.ObjectOp): PathLog.debug('processing {} jobshapes'.format(len(jobshapes))) wires = [] for shape in jobshapes: + shapeWires = shape.Wires PathLog.debug('jobshape has {} edges'.format(len(shape.Edges))) self.commandlist.append(Path.Command('G0', {'Z': obj.ClearanceHeight.Value, 'F': self.vertRapid})) - shapeWires = shape.Wires - self.buildpathocc(obj, shape.Wires, self.getZValues(obj)) + self.buildpathocc(obj, shapeWires, self.getZValues(obj)) wires.extend(shapeWires) self.wires = wires PathLog.debug('processing {} jobshapes -> {} wires'.format(len(jobshapes), len(wires))) From 487cfd1a68a892f2db5526720e0035e93db288ac Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Fri, 3 Jan 2020 23:03:43 -0800 Subject: [PATCH 10/11] Fixed removal of 2d objects from engrave ops --- src/Mod/Path/PathScripts/PathEngraveGui.py | 16 +++++++++------- src/Mod/Path/PathScripts/PathOpGui.py | 4 ++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathEngraveGui.py b/src/Mod/Path/PathScripts/PathEngraveGui.py index ea525524ab..4147bc0ea7 100644 --- a/src/Mod/Path/PathScripts/PathEngraveGui.py +++ b/src/Mod/Path/PathScripts/PathEngraveGui.py @@ -36,13 +36,8 @@ __author__ = "sliptonic (Brad Collette)" __url__ = "http://www.freecadweb.org" __doc__ = "Engrave operation page controller and command implementation." -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) @@ -53,6 +48,13 @@ class TaskPanelBaseGeometryPage(PathOpGui.TaskPanelBaseGeometryPage): def super(self): return super(TaskPanelBaseGeometryPage, self) + def selectionSupportedAsBaseGeometry(self, selection, ignoreErrors): + # allow selection of an entire 2D object, which is generally not the case + if len(selection) == 1 and not selection[0].HasSubObjects and selection[0].Object.isDerivedFrom('Part::Part2DObject'): + return True + # Let general logic handle all other cases. + return self.super().selectionSupportedAsBaseGeometry(selection, ignoreErrors) + def addBaseGeometry(self, selection): added = False shapes = self.obj.BaseShapes diff --git a/src/Mod/Path/PathScripts/PathOpGui.py b/src/Mod/Path/PathScripts/PathOpGui.py index 19bd611a17..ef324a7dad 100644 --- a/src/Mod/Path/PathScripts/PathOpGui.py +++ b/src/Mod/Path/PathScripts/PathOpGui.py @@ -502,9 +502,9 @@ class TaskPanelBaseGeometryPage(TaskPanelPage): for i in range(self.form.baseList.count()): item = self.form.baseList.item(i) obj = item.data(self.DataObject) - sub = str(item.data(self.DataObjectSub)) + sub = item.data(self.DataObjectSub) if sub: - base = (obj, sub) + base = (obj, str(sub)) newlist.append(base) PathLog.debug("Setting new base: %s -> %s" % (self.obj.Base, newlist)) self.obj.Base = newlist From 81f809cfcf942f46968ff5579236ad3f60f0736b Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Fri, 3 Jan 2020 23:13:55 -0800 Subject: [PATCH 11/11] Removed dead code for debugging shortcut warnings. --- src/Mod/Path/PathScripts/PathCircularHoleBase.py | 9 ++------- src/Mod/Path/PathScripts/PathDeburr.py | 9 ++------- src/Mod/Path/PathScripts/PathDressupDogbone.py | 9 ++------- src/Mod/Path/PathScripts/PathDressupTag.py | 4 ++-- src/Mod/Path/PathScripts/PathDrilling.py | 9 ++------- src/Mod/Path/PathScripts/PathEngrave.py | 4 ++-- src/Mod/Path/PathScripts/PathEngraveBase.py | 9 ++------- src/Mod/Path/PathScripts/PathGeom.py | 4 ++-- src/Mod/Path/PathScripts/PathIconViewProvider.py | 9 ++------- src/Mod/Path/PathScripts/PathJob.py | 9 ++------- src/Mod/Path/PathScripts/PathJobDlg.py | 9 ++------- src/Mod/Path/PathScripts/PathMillFace.py | 9 ++------- src/Mod/Path/PathScripts/PathOp.py | 9 ++------- src/Mod/Path/PathScripts/PathOpTools.py | 9 ++------- src/Mod/Path/PathScripts/PathPocket.py | 9 ++------- src/Mod/Path/PathScripts/PathPocketBase.py | 9 ++------- src/Mod/Path/PathScripts/PathPost.py | 2 +- src/Mod/Path/PathScripts/PathProfileBase.py | 9 ++------- src/Mod/Path/PathScripts/PathProfileContour.py | 9 ++------- src/Mod/Path/PathScripts/PathProfileEdges.py | 9 ++------- src/Mod/Path/PathScripts/PathProfileFaces.py | 3 +-- src/Mod/Path/PathScripts/PathSelection.py | 7 ++----- src/Mod/Path/PathScripts/PathSetupSheet.py | 9 ++------- src/Mod/Path/PathScripts/PathSetupSheetOpPrototype.py | 9 ++------- src/Mod/Path/PathScripts/PathStock.py | 10 ++-------- src/Mod/Path/PathScripts/PathSurface.py | 9 ++------- src/Mod/Path/PathScripts/PathUtils.py | 9 ++------- src/Mod/Path/PathTests/TestPathHelix.py | 4 ++-- 28 files changed, 54 insertions(+), 164 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathCircularHoleBase.py b/src/Mod/Path/PathScripts/PathCircularHoleBase.py index 12daca5567..0f41539378 100644 --- a/src/Mod/Path/PathScripts/PathCircularHoleBase.py +++ b/src/Mod/Path/PathScripts/PathCircularHoleBase.py @@ -59,13 +59,8 @@ def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) class ObjectOp(PathOp.ObjectOp): diff --git a/src/Mod/Path/PathScripts/PathDeburr.py b/src/Mod/Path/PathScripts/PathDeburr.py index 109f4970ce..766450ea38 100644 --- a/src/Mod/Path/PathScripts/PathDeburr.py +++ b/src/Mod/Path/PathScripts/PathDeburr.py @@ -32,13 +32,8 @@ import math from PySide import QtCore -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) # Qt translation handling diff --git a/src/Mod/Path/PathScripts/PathDressupDogbone.py b/src/Mod/Path/PathScripts/PathDressupDogbone.py index ef21c277a1..80e697a691 100644 --- a/src/Mod/Path/PathScripts/PathDressupDogbone.py +++ b/src/Mod/Path/PathScripts/PathDressupDogbone.py @@ -37,13 +37,8 @@ from PySide import QtCore LOG_MODULE = PathLog.thisModule() -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE) - PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE) -else: - PathLog.setLevel(PathLog.Level.NOTICE, LOG_MODULE) +PathLog.setLevel(PathLog.Level.NOTICE, LOG_MODULE) +#PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE) # Qt translation handling diff --git a/src/Mod/Path/PathScripts/PathDressupTag.py b/src/Mod/Path/PathScripts/PathDressupTag.py index 263ea19336..403210fbd3 100644 --- a/src/Mod/Path/PathScripts/PathDressupTag.py +++ b/src/Mod/Path/PathScripts/PathDressupTag.py @@ -33,8 +33,8 @@ import math from PathScripts.PathDressupTagPreferences import HoldingTagPreferences from PySide import QtCore -PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) -PathLog.trackModule() +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule() # Qt translation handling diff --git a/src/Mod/Path/PathScripts/PathDrilling.py b/src/Mod/Path/PathScripts/PathDrilling.py index ce370aa191..a1e436efa3 100644 --- a/src/Mod/Path/PathScripts/PathDrilling.py +++ b/src/Mod/Path/PathScripts/PathDrilling.py @@ -48,13 +48,8 @@ __created__ = "2014" __scriptVersion__ = "1c testing" __lastModified__ = "2019-06-25 14:49 CST" -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) # Qt translation handling diff --git a/src/Mod/Path/PathScripts/PathEngrave.py b/src/Mod/Path/PathScripts/PathEngrave.py index 034a19cf59..8063e73484 100644 --- a/src/Mod/Path/PathScripts/PathEngrave.py +++ b/src/Mod/Path/PathScripts/PathEngrave.py @@ -35,8 +35,8 @@ from PySide import QtCore __doc__ = "Class and implementation of Path Engrave operation" -PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) -PathLog.trackModule(PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) # Qt translation handling diff --git a/src/Mod/Path/PathScripts/PathEngraveBase.py b/src/Mod/Path/PathScripts/PathEngraveBase.py index 9b9239ea6d..fbb13125fd 100644 --- a/src/Mod/Path/PathScripts/PathEngraveBase.py +++ b/src/Mod/Path/PathScripts/PathEngraveBase.py @@ -34,13 +34,8 @@ from PySide import QtCore __doc__ = "Base class for all ops in the engrave family." -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) # Qt translation handling def translate(context, text, disambig=None): diff --git a/src/Mod/Path/PathScripts/PathGeom.py b/src/Mod/Path/PathScripts/PathGeom.py index ae26c53b5a..c4ad4faa5d 100644 --- a/src/Mod/Path/PathScripts/PathGeom.py +++ b/src/Mod/Path/PathScripts/PathGeom.py @@ -38,8 +38,8 @@ __doc__ = "Functions to extract and convert between Path.Command and Part.Edge a Tolerance = 0.000001 -PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) -PathLog.trackModule(PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) # Qt translation handling def translate(context, text, disambig=None): diff --git a/src/Mod/Path/PathScripts/PathIconViewProvider.py b/src/Mod/Path/PathScripts/PathIconViewProvider.py index a7ae69a9ba..cb5819f8d0 100644 --- a/src/Mod/Path/PathScripts/PathIconViewProvider.py +++ b/src/Mod/Path/PathScripts/PathIconViewProvider.py @@ -31,13 +31,8 @@ __author__ = "sliptonic (Brad Collette)" __url__ = "http://www.freecadweb.org" __doc__ = "ViewProvider who's main and only task is to assign an icon." -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) class ViewProvider(object): '''Generic view provider to assign an icon.''' diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py index 9a97fc40d9..c57291b470 100644 --- a/src/Mod/Path/PathScripts/PathJob.py +++ b/src/Mod/Path/PathScripts/PathJob.py @@ -37,13 +37,8 @@ import json from PathScripts.PathPostProcessor import PostProcessor from PySide import QtCore -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) # Qt translation handling diff --git a/src/Mod/Path/PathScripts/PathJobDlg.py b/src/Mod/Path/PathScripts/PathJobDlg.py index 06f8007857..fd6ea16f3e 100644 --- a/src/Mod/Path/PathScripts/PathJobDlg.py +++ b/src/Mod/Path/PathScripts/PathJobDlg.py @@ -38,13 +38,8 @@ from collections import Counter def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) class _ItemDelegate(QtGui.QStyledItemDelegate): diff --git a/src/Mod/Path/PathScripts/PathMillFace.py b/src/Mod/Path/PathScripts/PathMillFace.py index 3a32be9844..347d2fd4a2 100644 --- a/src/Mod/Path/PathScripts/PathMillFace.py +++ b/src/Mod/Path/PathScripts/PathMillFace.py @@ -43,13 +43,8 @@ __scriptVersion__ = "1d usable" __lastModified__ = "2019-07-22 23:49 CST" -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) # Qt translation handling diff --git a/src/Mod/Path/PathScripts/PathOp.py b/src/Mod/Path/PathScripts/PathOp.py index d90202a3b9..41297bf474 100644 --- a/src/Mod/Path/PathScripts/PathOp.py +++ b/src/Mod/Path/PathScripts/PathOp.py @@ -38,13 +38,8 @@ __author__ = "sliptonic (Brad Collette)" __url__ = "http://www.freecadweb.org" __doc__ = "Base class and properties implementation for all Path operations." -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule() -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule() # Qt translation handling diff --git a/src/Mod/Path/PathScripts/PathOpTools.py b/src/Mod/Path/PathScripts/PathOpTools.py index f4dc477367..7ce01d92af 100644 --- a/src/Mod/Path/PathScripts/PathOpTools.py +++ b/src/Mod/Path/PathScripts/PathOpTools.py @@ -35,13 +35,8 @@ __author__ = "sliptonic (Brad Collette)" __url__ = "http://www.freecadweb.org" __doc__ = "Collection of functions used by various Path operations. The functions are specific to Path and the algorithms employed by Path's operations." -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) PrintWireDebug = False diff --git a/src/Mod/Path/PathScripts/PathPocket.py b/src/Mod/Path/PathScripts/PathPocket.py index 0110435eba..239faa4ff2 100644 --- a/src/Mod/Path/PathScripts/PathPocket.py +++ b/src/Mod/Path/PathScripts/PathPocket.py @@ -40,13 +40,8 @@ __created__ = "2014" __scriptVersion__ = "2g testing" __lastModified__ = "2019-07-20 22:02 CST" -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) # Qt translation handling diff --git a/src/Mod/Path/PathScripts/PathPocketBase.py b/src/Mod/Path/PathScripts/PathPocketBase.py index 3a0fb2f097..c3ac4512af 100644 --- a/src/Mod/Path/PathScripts/PathPocketBase.py +++ b/src/Mod/Path/PathScripts/PathPocketBase.py @@ -33,13 +33,8 @@ __author__ = "sliptonic (Brad Collette)" __url__ = "http://www.freecadweb.org" __doc__ = "Base class and implementation for Path pocket operations." -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) # Qt translation handling def translate(context, text, disambig=None): diff --git a/src/Mod/Path/PathScripts/PathPost.py b/src/Mod/Path/PathScripts/PathPost.py index b69fa8b093..9799a2d201 100644 --- a/src/Mod/Path/PathScripts/PathPost.py +++ b/src/Mod/Path/PathScripts/PathPost.py @@ -41,7 +41,7 @@ from PySide import QtCore, QtGui LOG_MODULE = PathLog.thisModule() -PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE) +PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE) # Qt translation handling diff --git a/src/Mod/Path/PathScripts/PathProfileBase.py b/src/Mod/Path/PathScripts/PathProfileBase.py index bfeeded59c..b406dd127b 100644 --- a/src/Mod/Path/PathScripts/PathProfileBase.py +++ b/src/Mod/Path/PathScripts/PathProfileBase.py @@ -32,13 +32,8 @@ __author__ = "sliptonic (Brad Collette)" __url__ = "http://www.freecadweb.org" __doc__ = "Base class and implementation for Path profile operations." -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) # Qt translation handling def translate(context, text, disambig=None): diff --git a/src/Mod/Path/PathScripts/PathProfileContour.py b/src/Mod/Path/PathScripts/PathProfileContour.py index 6450915474..8a08ceeea1 100644 --- a/src/Mod/Path/PathScripts/PathProfileContour.py +++ b/src/Mod/Path/PathScripts/PathProfileContour.py @@ -36,13 +36,8 @@ from PySide import QtCore FreeCAD.setLogLevel('Path.Area', 0) -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) # Qt translation handling def translate(context, text, disambig=None): diff --git a/src/Mod/Path/PathScripts/PathProfileEdges.py b/src/Mod/Path/PathScripts/PathProfileEdges.py index 3f86b01ac7..b39f6c7447 100644 --- a/src/Mod/Path/PathScripts/PathProfileEdges.py +++ b/src/Mod/Path/PathScripts/PathProfileEdges.py @@ -33,13 +33,8 @@ import PathScripts.PathUtils as PathUtils from DraftGeomUtils import findWires from PySide import QtCore -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) # Qt translation handling diff --git a/src/Mod/Path/PathScripts/PathProfileFaces.py b/src/Mod/Path/PathScripts/PathProfileFaces.py index 81a27916d1..620a6196e9 100644 --- a/src/Mod/Path/PathScripts/PathProfileFaces.py +++ b/src/Mod/Path/PathScripts/PathProfileFaces.py @@ -43,8 +43,7 @@ __created__ = "2014" __scriptVersion__ = "2j usable" __lastModified__ = "2019-07-25 14:48 CST" -LOGLEVEL = PathLog.Level.INFO # change to .DEBUG to enable debugging messages -PathLog.setLevel(LOGLEVEL, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) # Qt translation handling def translate(context, text, disambig=None): diff --git a/src/Mod/Path/PathScripts/PathSelection.py b/src/Mod/Path/PathScripts/PathSelection.py index 748abfd346..4cadfd8926 100644 --- a/src/Mod/Path/PathScripts/PathSelection.py +++ b/src/Mod/Path/PathScripts/PathSelection.py @@ -29,11 +29,8 @@ import PathScripts.PathLog as PathLog import PathScripts.PathUtils as PathUtils import math -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) class PathBaseGate(object): # pylint: disable=no-init diff --git a/src/Mod/Path/PathScripts/PathSetupSheet.py b/src/Mod/Path/PathScripts/PathSetupSheet.py index aaaca2732e..e2a4bcd781 100644 --- a/src/Mod/Path/PathScripts/PathSetupSheet.py +++ b/src/Mod/Path/PathScripts/PathSetupSheet.py @@ -36,13 +36,8 @@ __doc__ = "A container for all default values and job specific configuration val _RegisteredOps = {} -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule() -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) def translate(context, text, disambig=None): return PySide.QtCore.QCoreApplication.translate(context, text, disambig) diff --git a/src/Mod/Path/PathScripts/PathSetupSheetOpPrototype.py b/src/Mod/Path/PathScripts/PathSetupSheetOpPrototype.py index fba3d33f0e..fa99cbc72b 100644 --- a/src/Mod/Path/PathScripts/PathSetupSheetOpPrototype.py +++ b/src/Mod/Path/PathScripts/PathSetupSheetOpPrototype.py @@ -30,13 +30,8 @@ __url__ = "http://www.freecadweb.org" __doc__ = "Prototype objects to allow extraction of setup sheet values and editing." -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) class Property(object): '''Base class for all prototype properties''' diff --git a/src/Mod/Path/PathScripts/PathStock.py b/src/Mod/Path/PathScripts/PathStock.py index 7cabb4f7ff..a8b8e9999f 100644 --- a/src/Mod/Path/PathScripts/PathStock.py +++ b/src/Mod/Path/PathScripts/PathStock.py @@ -30,14 +30,8 @@ import math from PySide import QtCore - -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) # Qt translation handling def translate(context, text, disambig=None): diff --git a/src/Mod/Path/PathScripts/PathSurface.py b/src/Mod/Path/PathScripts/PathSurface.py index 09d8d82219..0b83a57079 100644 --- a/src/Mod/Path/PathScripts/PathSurface.py +++ b/src/Mod/Path/PathScripts/PathSurface.py @@ -77,13 +77,8 @@ __created__ = "2016" __scriptVersion__ = "3t Usable" __lastModified__ = "2019-05-10 10:37 CST" -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) # Qt translation handling diff --git a/src/Mod/Path/PathScripts/PathUtils.py b/src/Mod/Path/PathScripts/PathUtils.py index 49091585ab..75f9109080 100644 --- a/src/Mod/Path/PathScripts/PathUtils.py +++ b/src/Mod/Path/PathScripts/PathUtils.py @@ -38,13 +38,8 @@ from PathScripts import PathLog from PySide import QtCore from PySide import QtGui -LOGLEVEL = False - -if LOGLEVEL: - PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) - PathLog.trackModule(PathLog.thisModule()) -else: - PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) def translate(context, text, disambig=None): diff --git a/src/Mod/Path/PathTests/TestPathHelix.py b/src/Mod/Path/PathTests/TestPathHelix.py index de417c325c..ab4012cf50 100644 --- a/src/Mod/Path/PathTests/TestPathHelix.py +++ b/src/Mod/Path/PathTests/TestPathHelix.py @@ -29,8 +29,8 @@ import PathScripts.PathJob as PathJob import PathScripts.PathLog as PathLog import PathTests.PathTestUtils as PathTestUtils -PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) -PathLog.trackModule(PathLog.thisModule()) +PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.trackModule(PathLog.thisModule()) class TestPathHelix(PathTestUtils.PathTestBase):