From 7d8f084ae997df7810226ea83be22dec65435aca Mon Sep 17 00:00:00 2001 From: Russell Johnson <47639332+Russ4262@users.noreply.github.com> Date: Tue, 18 Jun 2019 19:59:57 -0500 Subject: [PATCH 1/6] `proxy` to `obj.Proxy` partial conversion --- src/Mod/Path/PathScripts/PathAdaptive.py | 2 +- src/Mod/Path/PathScripts/PathDrilling.py | 4 ++-- src/Mod/Path/PathScripts/PathJob.py | 2 +- src/Mod/Path/PathScripts/PathPocketShape.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathAdaptive.py b/src/Mod/Path/PathScripts/PathAdaptive.py index 8feb92d8a7..45ffc5b5e2 100644 --- a/src/Mod/Path/PathScripts/PathAdaptive.py +++ b/src/Mod/Path/PathScripts/PathAdaptive.py @@ -536,5 +536,5 @@ def Create(name, obj = None): '''Create(name) ... Creates and returns a Adaptive operation.''' if obj is None: obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) - proxy = PathAdaptive(obj,name) + obj.Proxy = PathAdaptive(obj,name) return obj diff --git a/src/Mod/Path/PathScripts/PathDrilling.py b/src/Mod/Path/PathScripts/PathDrilling.py index f6f54e66f2..918d85bdbd 100644 --- a/src/Mod/Path/PathScripts/PathDrilling.py +++ b/src/Mod/Path/PathScripts/PathDrilling.py @@ -135,7 +135,7 @@ def Create(name, obj = None): '''Create(name) ... Creates and returns a Drilling operation.''' if obj is None: obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) - proxy = ObjectDrilling(obj, name) + obj.Proxy = ObjectDrilling(obj, name) if obj.Proxy: - proxy.findAllHoles(obj) + obj.Proxy.findAllHoles(obj) return obj diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py index 2ad26664ba..fc830e883d 100644 --- a/src/Mod/Path/PathScripts/PathJob.py +++ b/src/Mod/Path/PathScripts/PathJob.py @@ -409,6 +409,6 @@ def Create(name, base, templateFile = None): else: models = base obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) - proxy = ObjectJob(obj, models, templateFile) + obj.Proxy = ObjectJob(obj, models, templateFile) return obj diff --git a/src/Mod/Path/PathScripts/PathPocketShape.py b/src/Mod/Path/PathScripts/PathPocketShape.py index 5a9387d8a6..da1950dc6c 100644 --- a/src/Mod/Path/PathScripts/PathPocketShape.py +++ b/src/Mod/Path/PathScripts/PathPocketShape.py @@ -803,5 +803,5 @@ def Create(name, obj=None): '''Create(name) ... Creates and returns a Pocket operation.''' if obj is None: obj = FreeCAD.ActiveDocument.addObject('Path::FeaturePython', name) - obj.proxy = ObjectPocket(obj, name) + obj.Proxy = ObjectPocket(obj, name) return obj From f8de98d03c2cb6dd54609c3483068f7fadb9167b Mon Sep 17 00:00:00 2001 From: Russell Johnson <47639332+Russ4262@users.noreply.github.com> Date: Tue, 18 Jun 2019 22:38:58 -0500 Subject: [PATCH 2/6] Fix functionality of manual override of Final Depth manual Final Depth settings were limited to values greater than the base face for the Op. Manual settings of Final Depth may now proceed below the face (Outside profile ops) --- src/Mod/Path/PathScripts/PathProfileFaces.py | 149 ++++++++++--------- 1 file changed, 81 insertions(+), 68 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathProfileFaces.py b/src/Mod/Path/PathScripts/PathProfileFaces.py index 63e7807a31..eb90e0cf7e 100644 --- a/src/Mod/Path/PathScripts/PathProfileFaces.py +++ b/src/Mod/Path/PathScripts/PathProfileFaces.py @@ -48,8 +48,8 @@ __url__ = "http://www.freecadweb.org" __doc__ = "Path Profile operation based on faces." __contributors__ = "russ4262 (Russell Johnson)" __created__ = "2014" -__scriptVersion__ = "2g testing" -__lastModified__ = "2019-06-12 23:29 CST" +__scriptVersion__ = "2h testing" +__lastModified__ = "2019-06-18 22:36 CST" if False: PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) @@ -109,6 +109,8 @@ class ObjectProfile(PathProfileBase.ObjectProfile): shapes = [] self.profileshape = [] finalDepths = [] + startDepths = [] + faceDepths = [] baseSubsTuples = [] subCount = 0 @@ -179,9 +181,12 @@ class ObjectProfile(PathProfileBase.ObjectProfile): baseSubsTuples.append((base, subList, 0.0, 'X', stock)) # for base in obj.Base: + finish_step = obj.FinishDepth.Value if hasattr(obj, "FinishDepth") else 0.0 for (base, subsList, angle, axis, stock) in baseSubsTuples: holes = [] faces = [] + faceDepths = [] + startDepths = [] for sub in subsList: shape = getattr(base.Shape, sub) @@ -190,31 +195,40 @@ class ObjectProfile(PathProfileBase.ObjectProfile): if numpy.isclose(abs(shape.normalAt(0, 0).z), 1): # horizontal face for wire in shape.Wires[1:]: holes.append((base.Shape, wire)) + # Add face depth to list + faceDepths.append(shape.BoundBox.ZMin) else: ignoreSub = base.Name + '.' + sub msg = translate('Path', "Found a selected object which is not a face. Ignoring: {}".format(ignoreSub)) PathLog.error(msg) FreeCAD.Console.PrintWarning(msg) - # return + + # Raise FinalDepth to lowest face in list on Inside profile ops + finDep = obj.FinalDepth.Value + if obj.Side == 'Inside': + finDep = min(faceDepths) + finalDepths.append(finDep) + + strDep = obj.StartDepth.Value + if strDep > stock.Shape.BoundBox.ZMax: + strDep = stock.Shape.BoundBox.ZMax + startDepths.append(strDep) + + # Recalculate depthparams + self.depthparams = PathUtils.depth_params( + clearance_height=obj.ClearanceHeight.Value, + safe_height=obj.SafeHeight.Value, + start_depth=strDep, # obj.StartDepth.Value, + step_down=obj.StepDown.Value, + z_finish_step=finish_step, + final_depth=finDep, # obj.FinalDepth.Value, + user_depths=None) for shape, wire in holes: f = Part.makeFace(wire, 'Part::FaceMakerSimple') drillable = PathUtils.isDrillable(shape, wire) if (drillable and obj.processCircles) or (not drillable and obj.processHoles): PathLog.track() - # Recalculate depthparams - (strDep, finDep) = self.calculateStartFinalDepths(obj, shape, stock) - finalDepths.append(finDep) - PathLog.debug("Adjusted face depths strDep: {}, and finDep: {}".format(self.strDep, self.finDep)) - finish_step = obj.FinishDepth.Value if hasattr(obj, "FinishDepth") else 0.0 - self.depthparams = PathUtils.depth_params( - clearance_height=obj.ClearanceHeight.Value, - safe_height=obj.SafeHeight.Value, - start_depth=strDep, # obj.StartDepth.Value, - step_down=obj.StepDown.Value, - z_finish_step=finish_step, - final_depth=finDep, # obj.FinalDepth.Value, - user_depths=None) env = PathUtils.getEnvelope(shape, subshape=f, depthparams=self.depthparams) # shapes.append((env, True)) tup = env, True, 'pathProfileFaces', angle, axis, strDep, finDep @@ -226,23 +240,6 @@ class ObjectProfile(PathProfileBase.ObjectProfile): if obj.processPerimeter: PathLog.track() - if profileshape: - # Recalculate depthparams - (strDep, finDep) = self.calculateStartFinalDepths(obj, profileshape, stock) - finalDepths.append(finDep) - PathLog.debug("Adjusted face depths strDep: {}, and finDep: {}".format(self.strDep, self.finDep)) - finish_step = obj.FinishDepth.Value if hasattr(obj, "FinishDepth") else 0.0 - self.depthparams = PathUtils.depth_params( - clearance_height=obj.ClearanceHeight.Value, - safe_height=obj.SafeHeight.Value, - start_depth=strDep, # obj.StartDepth.Value, - step_down=obj.StepDown.Value, - z_finish_step=finish_step, - final_depth=finDep, # obj.FinalDepth.Value, - user_depths=None) - else: - strDep = obj.StartDepth.Value - finDep = obj.FinalDepth.Value try: env = PathUtils.getEnvelope(base.Shape, subshape=profileshape, depthparams=self.depthparams) except Exception: @@ -254,50 +251,63 @@ class ObjectProfile(PathProfileBase.ObjectProfile): shapes.append(tup) else: for shape in faces: + finalDep = finDep # Recalculate depthparams - (strDep, finDep) = self.calculateStartFinalDepths(obj, shape, stock) - finalDepths.append(finDep) - finish_step = obj.FinishDepth.Value if hasattr(obj, "FinishDepth") else 0.0 - self.depthparams = PathUtils.depth_params( - clearance_height=obj.ClearanceHeight.Value, - safe_height=obj.SafeHeight.Value, - start_depth=strDep, # obj.StartDepth.Value, - step_down=obj.StepDown.Value, - z_finish_step=finish_step, - final_depth=finDep, # obj.FinalDepth.Value, - user_depths=None) - env = PathUtils.getEnvelope(base.Shape, subshape=shape, depthparams=self.depthparams) - tup = env, False, 'pathProfileFaces', angle, axis, strDep, finDep + if obj.Side == 'Inside': + if finalDep < shape.BoundBox.ZMin: + custDepthparams = PathUtils.depth_params( + clearance_height=obj.ClearanceHeight.Value, + safe_height=obj.SafeHeight.Value, + start_depth=strDep, # obj.StartDepth.Value, + step_down=obj.StepDown.Value, + z_finish_step=finish_step, + final_depth=shape.BoundBox.ZMin, # obj.FinalDepth.Value, + user_depths=None) + env = PathUtils.getEnvelope(base.Shape, subshape=shape, depthparams=custDepthparams) + finalDep = shape.BoundBox.ZMin + else: + env = PathUtils.getEnvelope(base.Shape, subshape=shape, depthparams=self.depthparams) + else: + env = PathUtils.getEnvelope(base.Shape, subshape=shape, depthparams=self.depthparams) + tup = env, False, 'pathProfileFaces', angle, axis, strDep, finalDep shapes.append(tup) # Eif - # adjust FinalDepth as needed - finalDepth = min(finalDepths) - if obj.FinalDepth.Value < finalDepth: - obj.FinalDepth.Value = finalDepth + # adjust Start/Final Depths as needed + # Raise existing Final Depth to level of lowest profile face + if obj.Side == 'Inside': + finalDepth = min(finalDepths) + if obj.FinalDepth.Value < finalDepth: + obj.FinalDepth.Value = finalDepth + # Lower high Start Depth to top of Stock + startDepth = max(startDepths) + if obj.StartDepth.Value > startDepth: + obj.StartDepth.Value = startDepth else: # Try to build targets from the job base - if 1 == len(self.model) and hasattr(self.model[0], "Proxy"): - if isinstance(self.model[0].Proxy, ArchPanel.PanelSheet): # process the sheet - if obj.processCircles or obj.processHoles: - for shape in self.model[0].Proxy.getHoles(self.model[0], transform=True): - for wire in shape.Wires: - drillable = PathUtils.isDrillable(self.model[0].Proxy, wire) - if (drillable and obj.processCircles) or (not drillable and obj.processHoles): + if 1 == len(self.model): + if hasattr(self.model[0], "Proxy"): + PathLog.info("hasattr() Proxy") + if isinstance(self.model[0].Proxy, ArchPanel.PanelSheet): # process the sheet + if obj.processCircles or obj.processHoles: + for shape in self.model[0].Proxy.getHoles(self.model[0], transform=True): + for wire in shape.Wires: + drillable = PathUtils.isDrillable(self.model[0].Proxy, wire) + if (drillable and obj.processCircles) or (not drillable and obj.processHoles): + f = Part.makeFace(wire, 'Part::FaceMakerSimple') + env = PathUtils.getEnvelope(self.model[0].Shape, subshape=f, depthparams=self.depthparams) + # shapes.append((env, True)) + tup = env, True, 'pathProfileFaces', 0.0, 'X', obj.StartDepth.Value, obj.FinalDepth.Value + shapes.append(tup) + + if obj.processPerimeter: + for shape in self.model[0].Proxy.getOutlines(self.model[0], transform=True): + for wire in shape.Wires: f = Part.makeFace(wire, 'Part::FaceMakerSimple') env = PathUtils.getEnvelope(self.model[0].Shape, subshape=f, depthparams=self.depthparams) - # shapes.append((env, True)) - tup = env, True, 'pathProfileFaces', 0.0, 'X', obj.StartDepth.Value, obj.FinalDepth.Value + # shapes.append((env, False)) + tup = env, False, 'pathProfileFaces', 0.0, 'X', obj.StartDepth.Value, obj.FinalDepth.Value shapes.append(tup) - if obj.processPerimeter: - for shape in self.model[0].Proxy.getOutlines(self.model[0], transform=True): - for wire in shape.Wires: - f = Part.makeFace(wire, 'Part::FaceMakerSimple') - env = PathUtils.getEnvelope(self.model[0].Shape, subshape=f, depthparams=self.depthparams) - # shapes.append((env, False)) - tup = env, False, 'pathProfileFaces', 0.0, 'X', obj.StartDepth.Value, obj.FinalDepth.Value - shapes.append(tup) - self.removalshapes = shapes PathLog.debug("%d shapes" % len(shapes)) @@ -315,6 +325,9 @@ class ObjectProfile(PathProfileBase.ObjectProfile): obj.AttemptInverseAngle = True obj.B_AxisErrorOverride = False + def checkDepths(self, obj, shape): + return (strDept, finDep) + def SetupProperties(): setup = PathProfileBase.SetupProperties() From 8b3c4ac0e80c6aaa7166312fb19244d4c899c09e Mon Sep 17 00:00:00 2001 From: Russell Johnson <47639332+Russ4262@users.noreply.github.com> Date: Wed, 19 Jun 2019 23:35:13 -0500 Subject: [PATCH 3/6] Fixes bug #4008: removes phantom path cause Job object was base of transformations, rather than Job base(clone). --- src/Mod/Path/PathScripts/PathJobGui.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Mod/Path/PathScripts/PathJobGui.py b/src/Mod/Path/PathScripts/PathJobGui.py index 98816b478e..25b5edf58b 100644 --- a/src/Mod/Path/PathScripts/PathJobGui.py +++ b/src/Mod/Path/PathScripts/PathJobGui.py @@ -1060,6 +1060,10 @@ class TaskPanel: Draft.move(sel.Object, by) def updateSelection(self): + # Remove Job object if present in Selection: source of phantom paths + if self.obj in FreeCADGui.Selection.getSelection(): + FreeCADGui.Selection.removeSelection(self.obj) + sel = FreeCADGui.Selection.getSelectionEx() if len(sel) == 1 and len(sel[0].SubObjects) == 1: From 2e0861babc4359f9a925dfd0540990051fd7b321 Mon Sep 17 00:00:00 2001 From: Russell Johnson <47639332+Russ4262@users.noreply.github.com> Date: Tue, 18 Jun 2019 19:59:57 -0500 Subject: [PATCH 4/6] `proxy` to `obj.Proxy` partial conversion --- src/Mod/Path/PathScripts/PathAdaptive.py | 2 +- src/Mod/Path/PathScripts/PathDrilling.py | 4 ++-- src/Mod/Path/PathScripts/PathJob.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathAdaptive.py b/src/Mod/Path/PathScripts/PathAdaptive.py index 8feb92d8a7..45ffc5b5e2 100644 --- a/src/Mod/Path/PathScripts/PathAdaptive.py +++ b/src/Mod/Path/PathScripts/PathAdaptive.py @@ -536,5 +536,5 @@ def Create(name, obj = None): '''Create(name) ... Creates and returns a Adaptive operation.''' if obj is None: obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) - proxy = PathAdaptive(obj,name) + obj.Proxy = PathAdaptive(obj,name) return obj diff --git a/src/Mod/Path/PathScripts/PathDrilling.py b/src/Mod/Path/PathScripts/PathDrilling.py index f6f54e66f2..918d85bdbd 100644 --- a/src/Mod/Path/PathScripts/PathDrilling.py +++ b/src/Mod/Path/PathScripts/PathDrilling.py @@ -135,7 +135,7 @@ def Create(name, obj = None): '''Create(name) ... Creates and returns a Drilling operation.''' if obj is None: obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) - proxy = ObjectDrilling(obj, name) + obj.Proxy = ObjectDrilling(obj, name) if obj.Proxy: - proxy.findAllHoles(obj) + obj.Proxy.findAllHoles(obj) return obj diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py index 2ad26664ba..fc830e883d 100644 --- a/src/Mod/Path/PathScripts/PathJob.py +++ b/src/Mod/Path/PathScripts/PathJob.py @@ -409,6 +409,6 @@ def Create(name, base, templateFile = None): else: models = base obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) - proxy = ObjectJob(obj, models, templateFile) + obj.Proxy = ObjectJob(obj, models, templateFile) return obj From 97f42a619344097b545d7edfaf0192df59b675de Mon Sep 17 00:00:00 2001 From: Russell Johnson <47639332+Russ4262@users.noreply.github.com> Date: Tue, 18 Jun 2019 22:38:58 -0500 Subject: [PATCH 5/6] Fix functionality of manual override of Final Depth manual Final Depth settings were limited to values greater than the base face for the Op. Manual settings of Final Depth may now proceed below the face (Outside profile ops) --- src/Mod/Path/PathScripts/PathProfileFaces.py | 149 ++++++++++--------- 1 file changed, 81 insertions(+), 68 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathProfileFaces.py b/src/Mod/Path/PathScripts/PathProfileFaces.py index 63e7807a31..eb90e0cf7e 100644 --- a/src/Mod/Path/PathScripts/PathProfileFaces.py +++ b/src/Mod/Path/PathScripts/PathProfileFaces.py @@ -48,8 +48,8 @@ __url__ = "http://www.freecadweb.org" __doc__ = "Path Profile operation based on faces." __contributors__ = "russ4262 (Russell Johnson)" __created__ = "2014" -__scriptVersion__ = "2g testing" -__lastModified__ = "2019-06-12 23:29 CST" +__scriptVersion__ = "2h testing" +__lastModified__ = "2019-06-18 22:36 CST" if False: PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) @@ -109,6 +109,8 @@ class ObjectProfile(PathProfileBase.ObjectProfile): shapes = [] self.profileshape = [] finalDepths = [] + startDepths = [] + faceDepths = [] baseSubsTuples = [] subCount = 0 @@ -179,9 +181,12 @@ class ObjectProfile(PathProfileBase.ObjectProfile): baseSubsTuples.append((base, subList, 0.0, 'X', stock)) # for base in obj.Base: + finish_step = obj.FinishDepth.Value if hasattr(obj, "FinishDepth") else 0.0 for (base, subsList, angle, axis, stock) in baseSubsTuples: holes = [] faces = [] + faceDepths = [] + startDepths = [] for sub in subsList: shape = getattr(base.Shape, sub) @@ -190,31 +195,40 @@ class ObjectProfile(PathProfileBase.ObjectProfile): if numpy.isclose(abs(shape.normalAt(0, 0).z), 1): # horizontal face for wire in shape.Wires[1:]: holes.append((base.Shape, wire)) + # Add face depth to list + faceDepths.append(shape.BoundBox.ZMin) else: ignoreSub = base.Name + '.' + sub msg = translate('Path', "Found a selected object which is not a face. Ignoring: {}".format(ignoreSub)) PathLog.error(msg) FreeCAD.Console.PrintWarning(msg) - # return + + # Raise FinalDepth to lowest face in list on Inside profile ops + finDep = obj.FinalDepth.Value + if obj.Side == 'Inside': + finDep = min(faceDepths) + finalDepths.append(finDep) + + strDep = obj.StartDepth.Value + if strDep > stock.Shape.BoundBox.ZMax: + strDep = stock.Shape.BoundBox.ZMax + startDepths.append(strDep) + + # Recalculate depthparams + self.depthparams = PathUtils.depth_params( + clearance_height=obj.ClearanceHeight.Value, + safe_height=obj.SafeHeight.Value, + start_depth=strDep, # obj.StartDepth.Value, + step_down=obj.StepDown.Value, + z_finish_step=finish_step, + final_depth=finDep, # obj.FinalDepth.Value, + user_depths=None) for shape, wire in holes: f = Part.makeFace(wire, 'Part::FaceMakerSimple') drillable = PathUtils.isDrillable(shape, wire) if (drillable and obj.processCircles) or (not drillable and obj.processHoles): PathLog.track() - # Recalculate depthparams - (strDep, finDep) = self.calculateStartFinalDepths(obj, shape, stock) - finalDepths.append(finDep) - PathLog.debug("Adjusted face depths strDep: {}, and finDep: {}".format(self.strDep, self.finDep)) - finish_step = obj.FinishDepth.Value if hasattr(obj, "FinishDepth") else 0.0 - self.depthparams = PathUtils.depth_params( - clearance_height=obj.ClearanceHeight.Value, - safe_height=obj.SafeHeight.Value, - start_depth=strDep, # obj.StartDepth.Value, - step_down=obj.StepDown.Value, - z_finish_step=finish_step, - final_depth=finDep, # obj.FinalDepth.Value, - user_depths=None) env = PathUtils.getEnvelope(shape, subshape=f, depthparams=self.depthparams) # shapes.append((env, True)) tup = env, True, 'pathProfileFaces', angle, axis, strDep, finDep @@ -226,23 +240,6 @@ class ObjectProfile(PathProfileBase.ObjectProfile): if obj.processPerimeter: PathLog.track() - if profileshape: - # Recalculate depthparams - (strDep, finDep) = self.calculateStartFinalDepths(obj, profileshape, stock) - finalDepths.append(finDep) - PathLog.debug("Adjusted face depths strDep: {}, and finDep: {}".format(self.strDep, self.finDep)) - finish_step = obj.FinishDepth.Value if hasattr(obj, "FinishDepth") else 0.0 - self.depthparams = PathUtils.depth_params( - clearance_height=obj.ClearanceHeight.Value, - safe_height=obj.SafeHeight.Value, - start_depth=strDep, # obj.StartDepth.Value, - step_down=obj.StepDown.Value, - z_finish_step=finish_step, - final_depth=finDep, # obj.FinalDepth.Value, - user_depths=None) - else: - strDep = obj.StartDepth.Value - finDep = obj.FinalDepth.Value try: env = PathUtils.getEnvelope(base.Shape, subshape=profileshape, depthparams=self.depthparams) except Exception: @@ -254,50 +251,63 @@ class ObjectProfile(PathProfileBase.ObjectProfile): shapes.append(tup) else: for shape in faces: + finalDep = finDep # Recalculate depthparams - (strDep, finDep) = self.calculateStartFinalDepths(obj, shape, stock) - finalDepths.append(finDep) - finish_step = obj.FinishDepth.Value if hasattr(obj, "FinishDepth") else 0.0 - self.depthparams = PathUtils.depth_params( - clearance_height=obj.ClearanceHeight.Value, - safe_height=obj.SafeHeight.Value, - start_depth=strDep, # obj.StartDepth.Value, - step_down=obj.StepDown.Value, - z_finish_step=finish_step, - final_depth=finDep, # obj.FinalDepth.Value, - user_depths=None) - env = PathUtils.getEnvelope(base.Shape, subshape=shape, depthparams=self.depthparams) - tup = env, False, 'pathProfileFaces', angle, axis, strDep, finDep + if obj.Side == 'Inside': + if finalDep < shape.BoundBox.ZMin: + custDepthparams = PathUtils.depth_params( + clearance_height=obj.ClearanceHeight.Value, + safe_height=obj.SafeHeight.Value, + start_depth=strDep, # obj.StartDepth.Value, + step_down=obj.StepDown.Value, + z_finish_step=finish_step, + final_depth=shape.BoundBox.ZMin, # obj.FinalDepth.Value, + user_depths=None) + env = PathUtils.getEnvelope(base.Shape, subshape=shape, depthparams=custDepthparams) + finalDep = shape.BoundBox.ZMin + else: + env = PathUtils.getEnvelope(base.Shape, subshape=shape, depthparams=self.depthparams) + else: + env = PathUtils.getEnvelope(base.Shape, subshape=shape, depthparams=self.depthparams) + tup = env, False, 'pathProfileFaces', angle, axis, strDep, finalDep shapes.append(tup) # Eif - # adjust FinalDepth as needed - finalDepth = min(finalDepths) - if obj.FinalDepth.Value < finalDepth: - obj.FinalDepth.Value = finalDepth + # adjust Start/Final Depths as needed + # Raise existing Final Depth to level of lowest profile face + if obj.Side == 'Inside': + finalDepth = min(finalDepths) + if obj.FinalDepth.Value < finalDepth: + obj.FinalDepth.Value = finalDepth + # Lower high Start Depth to top of Stock + startDepth = max(startDepths) + if obj.StartDepth.Value > startDepth: + obj.StartDepth.Value = startDepth else: # Try to build targets from the job base - if 1 == len(self.model) and hasattr(self.model[0], "Proxy"): - if isinstance(self.model[0].Proxy, ArchPanel.PanelSheet): # process the sheet - if obj.processCircles or obj.processHoles: - for shape in self.model[0].Proxy.getHoles(self.model[0], transform=True): - for wire in shape.Wires: - drillable = PathUtils.isDrillable(self.model[0].Proxy, wire) - if (drillable and obj.processCircles) or (not drillable and obj.processHoles): + if 1 == len(self.model): + if hasattr(self.model[0], "Proxy"): + PathLog.info("hasattr() Proxy") + if isinstance(self.model[0].Proxy, ArchPanel.PanelSheet): # process the sheet + if obj.processCircles or obj.processHoles: + for shape in self.model[0].Proxy.getHoles(self.model[0], transform=True): + for wire in shape.Wires: + drillable = PathUtils.isDrillable(self.model[0].Proxy, wire) + if (drillable and obj.processCircles) or (not drillable and obj.processHoles): + f = Part.makeFace(wire, 'Part::FaceMakerSimple') + env = PathUtils.getEnvelope(self.model[0].Shape, subshape=f, depthparams=self.depthparams) + # shapes.append((env, True)) + tup = env, True, 'pathProfileFaces', 0.0, 'X', obj.StartDepth.Value, obj.FinalDepth.Value + shapes.append(tup) + + if obj.processPerimeter: + for shape in self.model[0].Proxy.getOutlines(self.model[0], transform=True): + for wire in shape.Wires: f = Part.makeFace(wire, 'Part::FaceMakerSimple') env = PathUtils.getEnvelope(self.model[0].Shape, subshape=f, depthparams=self.depthparams) - # shapes.append((env, True)) - tup = env, True, 'pathProfileFaces', 0.0, 'X', obj.StartDepth.Value, obj.FinalDepth.Value + # shapes.append((env, False)) + tup = env, False, 'pathProfileFaces', 0.0, 'X', obj.StartDepth.Value, obj.FinalDepth.Value shapes.append(tup) - if obj.processPerimeter: - for shape in self.model[0].Proxy.getOutlines(self.model[0], transform=True): - for wire in shape.Wires: - f = Part.makeFace(wire, 'Part::FaceMakerSimple') - env = PathUtils.getEnvelope(self.model[0].Shape, subshape=f, depthparams=self.depthparams) - # shapes.append((env, False)) - tup = env, False, 'pathProfileFaces', 0.0, 'X', obj.StartDepth.Value, obj.FinalDepth.Value - shapes.append(tup) - self.removalshapes = shapes PathLog.debug("%d shapes" % len(shapes)) @@ -315,6 +325,9 @@ class ObjectProfile(PathProfileBase.ObjectProfile): obj.AttemptInverseAngle = True obj.B_AxisErrorOverride = False + def checkDepths(self, obj, shape): + return (strDept, finDep) + def SetupProperties(): setup = PathProfileBase.SetupProperties() From 332bfb5052a2f7d45c0683866eba79bf2807d22f Mon Sep 17 00:00:00 2001 From: Russell Johnson <47639332+Russ4262@users.noreply.github.com> Date: Wed, 19 Jun 2019 23:35:13 -0500 Subject: [PATCH 6/6] Fixes bug #4008: removes phantom path cause Job object was base of transformations, rather than Job base(clone). --- src/Mod/Path/PathScripts/PathJobGui.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Mod/Path/PathScripts/PathJobGui.py b/src/Mod/Path/PathScripts/PathJobGui.py index 98816b478e..25b5edf58b 100644 --- a/src/Mod/Path/PathScripts/PathJobGui.py +++ b/src/Mod/Path/PathScripts/PathJobGui.py @@ -1060,6 +1060,10 @@ class TaskPanel: Draft.move(sel.Object, by) def updateSelection(self): + # Remove Job object if present in Selection: source of phantom paths + if self.obj in FreeCADGui.Selection.getSelection(): + FreeCADGui.Selection.removeSelection(self.obj) + sel = FreeCADGui.Selection.getSelectionEx() if len(sel) == 1 and len(sel[0].SubObjects) == 1: