Added support for Part as base object.

This commit is contained in:
Markus Lampert
2017-09-21 11:32:32 -07:00
parent 87533cbb16
commit 992b2589b2
2 changed files with 26 additions and 5 deletions
+9
View File
@@ -40,6 +40,11 @@ NotValidBaseTypeIds = ['Sketcher::SketchObject']
def isValidBaseObject(obj):
'''isValidBaseObject(obj) ... returns true if the object can be used as a base for a job.'''
if hasattr(obj, 'getParentGeoFeatureGroup') and obj.getParentGeoFeatureGroup():
# Can't link to anything inside a geo feature group anymore
return False
if hasattr(obj, 'TypeId') and 'App::Part' == obj.TypeId:
return obj.Group and any(hasattr(o, 'Shape') for o in obj.Group)
if not hasattr(obj, 'Shape'):
return False
if obj.TypeId in NotValidBaseTypeIds:
@@ -58,6 +63,10 @@ def isSolid(obj):
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
return True
return False
def toolControllerForOp(op):