From 2eee30edd5833f30e4ba94b6b7d58f48b3d99560 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Mon, 18 Sep 2017 01:11:24 -0700 Subject: [PATCH] Fixed pocket depth calculation in case no base object is specified. --- src/Mod/Path/PathScripts/PathPocketShape.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Mod/Path/PathScripts/PathPocketShape.py b/src/Mod/Path/PathScripts/PathPocketShape.py index 8e81b8a5a4..a200797e1d 100644 --- a/src/Mod/Path/PathScripts/PathPocketShape.py +++ b/src/Mod/Path/PathScripts/PathPocketShape.py @@ -147,6 +147,11 @@ class ObjectPocket(PathPocketBase.ObjectPocket): '''areaOpSetDefaultValues(obj) ... set default values''' obj.StepOver = 100 obj.ZigZagAngle = 45 + job = PathUtils.findParentJob(obj) + if job and job.Stock: + bb = job.Stock.Shape.BoundBox + obj.FinalDepth = bb.ZMin + obj.StartDepth = bb.ZMax def areaOpOnChanged(self, obj, prop): if 'Base' == prop and obj.Base and not 'Restore' in obj.State: @@ -186,6 +191,13 @@ class ObjectPocket(PathPocketBase.ObjectPocket): if not PathGeom.isRoughly(safe, obj.SafeHeight.Value): obj.SafeHeight = safe + if prop in ['Base', 'Stock'] and not obj.Base and not 'Restore' in obj.State: + job = PathUtils.findParentJob(obj) + if job and job.Stock: + bb = job.Stock.Shape.BoundBox + obj.FinalDepth = bb.ZMin + obj.StartDepth = bb.ZMax + def Create(name): '''Create(name) ... Creates and returns a Pocket operation.'''