Added stock creation.
This commit is contained in:
@@ -37,9 +37,9 @@ import PathScripts.PathLog as PathLog
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
|
||||
NotValidBaseTypeIds = ['Sketcher::SketchObject']
|
||||
def isValidBaseObject(obj):
|
||||
'''isSolid(obj) ... returns true if an object represents a solid.'''
|
||||
|
||||
def isValidBaseObject(obj):
|
||||
'''isValidBaseObject(obj) ... returns true if the object can be used as a base for a job.'''
|
||||
if not hasattr(obj, 'Shape'):
|
||||
return False
|
||||
if obj.TypeId in NotValidBaseTypeIds:
|
||||
@@ -48,9 +48,23 @@ def isValidBaseObject(obj):
|
||||
return False
|
||||
return True
|
||||
|
||||
def isSolid(obj):
|
||||
'''isSolid(obj) ... return True if the object is a valid 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
|
||||
|
||||
def toolControllerForOp(op):
|
||||
if hasattr(op, 'ToolController'):
|
||||
return op.ToolController
|
||||
if hasattr(op, 'Base'):
|
||||
return toolControllerForOp(op.Base)
|
||||
return None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user