Switched solid detection to blacklisting instead of whitelisting.

This commit is contained in:
Markus Lampert
2017-06-14 10:44:34 -07:00
parent 40c92e49ee
commit 7a381ed7d0
2 changed files with 10 additions and 12 deletions

View File

@@ -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:

View File

@@ -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