From 7a381ed7d01ff87e6199ae3e1bd7e7799b49dca1 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Wed, 14 Jun 2017 10:44:34 -0700 Subject: [PATCH] Switched solid detection to blacklisting instead of whitelisting. --- src/Mod/Path/PathScripts/PathJob.py | 2 +- src/Mod/Path/PathScripts/PathUtil.py | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py index dc72ea4b9c..3aab5de075 100644 --- a/src/Mod/Path/PathScripts/PathJob.py +++ b/src/Mod/Path/PathScripts/PathJob.py @@ -169,7 +169,7 @@ class ObjectPathJob: @classmethod def isBaseCandidate(cls, obj): '''Answer true if the given object can be used as a Base for a job.''' - return PathUtil.isSolid(obj) or (hasattr(obj, 'Proxy') and isinstance(obj.Proxy, ArchPanel.PanelSheet)) + return PathUtil.isValidBaseObject(obj) or (hasattr(obj, 'Proxy') and isinstance(obj.Proxy, ArchPanel.PanelSheet)) class ViewProviderJob: diff --git a/src/Mod/Path/PathScripts/PathUtil.py b/src/Mod/Path/PathScripts/PathUtil.py index b3f2e5c9c3..e730297c57 100644 --- a/src/Mod/Path/PathScripts/PathUtil.py +++ b/src/Mod/Path/PathScripts/PathUtil.py @@ -36,16 +36,14 @@ import PathScripts.PathLog as PathLog PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) -def isSolid(obj): +NotValidBaseTypeIds = ['Sketcher::SketchObject'] +def isValidBaseObject(obj): '''isSolid(obj) ... returns true if an object represents a solid.''' - if hasattr(obj, 'Tip'): - return isSolid(obj.Tip) - if hasattr(obj, 'Shape'): - if obj.Shape.ShapeType == 'Solid' and obj.Shape.isClosed(): - return True - if obj.Shape.ShapeType == 'Compound': - if hasattr(obj, 'Base') and hasattr(obj, 'Tool'): - return isSolid(obj.Base) and isSolid(obj.Tool) - return False - + if not hasattr(obj, 'Shape'): + return False + if obj.TypeId in NotValidBaseTypeIds: + return False + if hasattr(obj, 'Sheets') or hasattr(obj, 'TagText'): # Arch.Panels and Arch.PanelCut + return False + return True