Fixed heights and introduced OpStockZMin/Max.

This commit is contained in:
Markus Lampert
2018-08-13 22:49:42 -07:00
parent 94fa64077b
commit c495ed43f8
4 changed files with 21 additions and 9 deletions

View File

@@ -145,7 +145,7 @@ class ObjectEngrave(PathEngraveBase.ObjectOp):
traceback.print_exc()
PathLog.error(translate('PathEngrave', 'The Job Base Object has no engraveable element. Engraving operation will produce no output.'))
def updateDepths(self, obj, ignoreErrors=False):
def opUpdateDepths(self, obj, ignoreErrors=False):
'''updateDepths(obj) ... engraving is always done at the top most z-value'''
self.opSetDefaultValues(obj)

View File

@@ -108,6 +108,11 @@ class ObjectOp(object):
if 'tooldia' in values:
obj.addProperty("App::PropertyDistance", "OpToolDiameter", "Op Values", QtCore.QT_TRANSLATE_NOOP("PathOp", "Holds the diameter of the tool"))
obj.setEditorMode('OpToolDiameter', 1) # read-only
if 'stockz' in values:
obj.addProperty("App::PropertyDistance", "OpStockZMax", "Op Values", QtCore.QT_TRANSLATE_NOOP("PathOp", "Holds the max Z value of Stock"))
obj.setEditorMode('OpStockZMax', 1) # read-only
obj.addProperty("App::PropertyDistance", "OpStockZMin", "Op Values", QtCore.QT_TRANSLATE_NOOP("PathOp", "Holds the min Z value of Stock"))
obj.setEditorMode('OpStockZMin', 1) # read-only
def __init__(self, obj):
PathLog.track()
@@ -139,6 +144,8 @@ class ObjectOp(object):
obj.addProperty("App::PropertyDistance", "StartDepth", "Depth", QtCore.QT_TRANSLATE_NOOP("PathOp", "Starting Depth internal use only for derived values"))
obj.setEditorMode('StartDepth', 1) # read-only
self.addOpValues(obj, ['stockz'])
if FeatureStepDown & features:
obj.addProperty("App::PropertyDistance", "StepDown", "Depth", QtCore.QT_TRANSLATE_NOOP("PathOp", "Incremental Step Down of Tool"))
@@ -185,6 +192,11 @@ class ObjectOp(object):
if FeatureDepths & features and not hasattr(obj, 'OpStartDepth'):
self.addOpValues(obj, ['start', 'final'])
if FeatureNoFinalDepth & features:
obj.setEditorMode('OpFinalDepth', 2)
if not hasattr(obj, 'OpStockZMax'):
self.addOpValues(obj, ['stockz'])
self.setEditorModes(obj, features)
self.opOnDocumentRestored(obj)
@@ -355,6 +367,9 @@ class ObjectOp(object):
zmin = stockBB.ZMin
zmax = stockBB.ZMax
obj.OpStockZMin = zmin
obj.OpStockZMax = zmax
if hasattr(obj, 'Base') and obj.Base:
for base, sublist in obj.Base:
bb = base.Shape.BoundBox

View File

@@ -104,12 +104,9 @@ class ObjectContour(PathProfileBase.ObjectProfile):
params['Coplanar'] = 2
return params
def updateDepths(self, obj, ignoreErrors=False):
if not hasattr(self, 'stock'):
self.stock = self.getJob(obj).Stock
stockBB = self.stock.Shape.BoundBox
obj.OpFinalDepth = stockBB.ZMin
obj.OpStartDepth = stockBB.ZMax
def opUpdateDepths(self, obj):
obj.OpStartDepth = obj.OpStockZMax
obj.OpFinalDepth = obj.OpStockZMin
def Create(name):

View File

@@ -81,8 +81,8 @@ class SetupSheet:
DefaultSafeHeightOffset = '3 mm'
DefaultClearanceHeightOffset = '5 mm'
DefaultSafeHeightExpression = "StartDepth+${SetupSheet}.SafeHeightOffset"
DefaultClearanceHeightExpression = "StartDepth+${SetupSheet}.ClearanceHeightOffset"
DefaultSafeHeightExpression = "OpStockZMax+${SetupSheet}.SafeHeightOffset"
DefaultClearanceHeightExpression = "OpStockZMax+${SetupSheet}.ClearanceHeightOffset"
DefaultStartDepthExpression = 'OpStartDepth'
DefaultFinalDepthExpression = 'OpFinalDepth'