CAM: Create stock height 1 mm for flat objects
This commit is contained in:
@@ -70,7 +70,7 @@ class StockType:
|
||||
|
||||
def shapeBoundBox(obj):
|
||||
Path.Log.track(type(obj))
|
||||
if list == type(obj) and obj:
|
||||
if isinstance(obj, list) and obj:
|
||||
bb = FreeCAD.BoundBox()
|
||||
for o in obj:
|
||||
bb.add(shapeBoundBox(o))
|
||||
@@ -106,6 +106,8 @@ class Stock(object):
|
||||
|
||||
|
||||
class StockFromBase(Stock):
|
||||
MinExtent = 1
|
||||
|
||||
def __init__(self, obj, base):
|
||||
"Make stock"
|
||||
obj.addProperty(
|
||||
@@ -210,6 +212,10 @@ class StockFromBase(Stock):
|
||||
|
||||
self.length = bb.XLength + obj.ExtXneg.Value + obj.ExtXpos.Value
|
||||
self.width = bb.YLength + obj.ExtYneg.Value + obj.ExtYpos.Value
|
||||
|
||||
if bb.ZLength + obj.ExtZneg.Value + obj.ExtZpos.Value <= 0:
|
||||
Path.Log.error("Stock height can not be zero or negative\nSet ExtZneg = 1 mm")
|
||||
obj.ExtZneg.Value = self.MinExtent
|
||||
self.height = bb.ZLength + obj.ExtZneg.Value + obj.ExtZpos.Value
|
||||
|
||||
shape = Part.makeBox(self.length, self.width, self.height, self.origin)
|
||||
@@ -219,7 +225,7 @@ class StockFromBase(Stock):
|
||||
def onChanged(self, obj, prop):
|
||||
if (
|
||||
prop in ["ExtXneg", "ExtXpos", "ExtYneg", "ExtYpos", "ExtZneg", "ExtZpos"]
|
||||
and not "Restore" in obj.State
|
||||
and "Restore" not in obj.State
|
||||
):
|
||||
self.execute(obj)
|
||||
|
||||
@@ -272,7 +278,7 @@ class StockCreateBox(Stock):
|
||||
obj.Shape = shape
|
||||
|
||||
def onChanged(self, obj, prop):
|
||||
if prop in ["Length", "Width", "Height"] and not "Restore" in obj.State:
|
||||
if prop in ["Length", "Width", "Height"] and "Restore" not in obj.State:
|
||||
self.execute(obj)
|
||||
|
||||
|
||||
@@ -315,7 +321,7 @@ class StockCreateCylinder(Stock):
|
||||
obj.Shape = shape
|
||||
|
||||
def onChanged(self, obj, prop):
|
||||
if prop in ["Radius", "Height"] and not "Restore" in obj.State:
|
||||
if prop in ["Radius", "Height"] and "Restore" not in obj.State:
|
||||
self.execute(obj)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user