New approach to determine if an object is a solid - based on it's volume.

This commit is contained in:
Markus Lampert
2018-09-01 16:49:48 -07:00
committed by wmayer
parent dda6d49388
commit 1f0bda27f6

View File

@@ -59,11 +59,8 @@ def isSolid(obj):
if hasattr(obj, 'Tip'):
return isSolid(obj.Tip)
if hasattr(obj, 'Shape'):
if obj.Shape.ShapeType == 'Solid' and obj.Shape.isClosed():
if obj.Shape.Volume > 0.0 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)
if hasattr(obj, 'TypeId') and 'App::Part' == obj.TypeId:
if not obj.Group or any(hasattr(o, 'Shape') and not isSolid(o) for o in obj.Group):
return False