Moved pocket specific logic back into PathPocket.

This commit is contained in:
Markus Lampert
2017-08-03 22:31:17 -07:00
committed by Yorik van Havre
parent a742c1120e
commit 83e5c8098b
2 changed files with 26 additions and 26 deletions

View File

@@ -276,34 +276,9 @@ class ObjectOp(object):
baselist = obj.Base
if baselist is None:
baselist = []
if len(baselist) == 0: # When adding the first base object, guess at heights
try:
bb = base.Shape.BoundBox # parent boundbox
subobj = base.Shape.getElement(sub)
fbb = subobj.BoundBox # feature boundbox
obj.StartDepth = bb.ZMax
obj.ClearanceHeight = bb.ZMax + 5.0
obj.SafeHeight = bb.ZMax + 3.0
if fbb.ZMax == fbb.ZMin and fbb.ZMax == bb.ZMax: # top face
obj.FinalDepth = bb.ZMin
elif fbb.ZMax > fbb.ZMin and fbb.ZMax == bb.ZMax: # vertical face, full cut
obj.FinalDepth = fbb.ZMin
elif fbb.ZMax > fbb.ZMin and fbb.ZMin > bb.ZMin: # internal vertical wall
obj.FinalDepth = fbb.ZMin
elif fbb.ZMax == fbb.ZMin and fbb.ZMax > bb.ZMin: # face/shelf
obj.FinalDepth = fbb.ZMin
else: # catch all
obj.FinalDepth = bb.ZMin
except:
obj.StartDepth = 5.0
obj.ClearanceHeight = 10.0
obj.SafeHeight = 8.0
item = (base, sub)
if item in baselist:
PathLog.warning(translate("Path", "this object already in the list" + "\n"))
else:
baselist.append(item)
obj.Base = baselist
obj.Base = baselist

View File

@@ -168,6 +168,31 @@ class ObjectPocket(PathAreaOp.ObjectOp):
obj.StepOver = 100
obj.ZigZagAngle = 45
def opOnChanged(self, obj, prop):
if prop == 'Base' and len(obj.Base) == 1:
try:
bb = base.Shape.BoundBox # parent boundbox
subobj = base.Shape.getElement(sub)
fbb = subobj.BoundBox # feature boundbox
obj.StartDepth = bb.ZMax
obj.ClearanceHeight = bb.ZMax + 5.0
obj.SafeHeight = bb.ZMax + 3.0
if fbb.ZMax == fbb.ZMin and fbb.ZMax == bb.ZMax: # top face
obj.FinalDepth = bb.ZMin
elif fbb.ZMax > fbb.ZMin and fbb.ZMax == bb.ZMax: # vertical face, full cut
obj.FinalDepth = fbb.ZMin
elif fbb.ZMax > fbb.ZMin and fbb.ZMin > bb.ZMin: # internal vertical wall
obj.FinalDepth = fbb.ZMin
elif fbb.ZMax == fbb.ZMin and fbb.ZMax > bb.ZMin: # face/shelf
obj.FinalDepth = fbb.ZMin
else: # catch all
obj.FinalDepth = bb.ZMin
except:
obj.StartDepth = 5.0
obj.ClearanceHeight = 10.0
obj.SafeHeight = 8.0
def Create(name):
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)