From 824bbead6d3ec2df4f78efd0ed1c169d79df9863 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Fri, 3 Jan 2020 23:03:43 -0800 Subject: [PATCH] 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