From 0ba06f3831402ac8c4f567e950cc97d74428ff79 Mon Sep 17 00:00:00 2001 From: Russell Johnson <47639332+Russ4262@users.noreply.github.com> Date: Fri, 5 Feb 2021 18:07:16 -0600 Subject: [PATCH] Path: Relocate edge preprocessing and apply `UseOutline` feature Working edges must be identified from Base Geometry selection features, discretized, and added to list for return value. --- src/Mod/Path/PathScripts/PathAdaptive.py | 38 +++++++++++++++++++----- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathAdaptive.py b/src/Mod/Path/PathScripts/PathAdaptive.py index e171813f80..1f069d102e 100644 --- a/src/Mod/Path/PathScripts/PathAdaptive.py +++ b/src/Mod/Path/PathScripts/PathAdaptive.py @@ -399,14 +399,9 @@ def Execute(op,obj): if obj.Tolerance < 0.001: obj.Tolerance = 0.001 - pathArray = [] - for base, subs in obj.Base: - for sub in subs: - shape = base.Shape.getElement(sub) - for edge in shape.Edges: - pathArray.append([discretize(edge)]) + # Get list of working edges for adaptive algorithm + pathArray = _get_working_edges(op, obj) - #pathArray=connectEdges(edges) path2d = convertTo2d(pathArray) stockPaths = [] @@ -529,6 +524,35 @@ def Execute(op,obj): sceneClean() +def _get_working_edges(op, obj): + """_get_working_edges(op, obj)... + Compile all working edges from the Base Geometry selection (obj.Base) + for the current operation. + Additional modifications to selected region(face), such as extensions, + should be placed within this function. + """ + pathArray = list() + + for base, subs in obj.Base: + for sub in subs: + if obj.UseOutline: + face = base.Shape.getElement(sub) + zmin = face.BoundBox.ZMin + # get face outline with same method in PocketShape + wire = TechDraw.findShapeOutline(face, 1, FreeCAD.Vector(0.0, 0.0, 1.0)) + shape = Part.Face(wire) + # translate to face height if necessary + if shape.BoundBox.ZMin != zmin: + shape.translate(FreeCAD.Vector(0.0, 0.0, zmin - shape.BoundBox.ZMin)) + else: + shape = base.Shape.getElement(sub) + + for edge in shape.Edges: + pathArray.append([discretize(edge)]) + + return pathArray + + class PathAdaptive(PathOp.ObjectOp): def opFeatures(self, obj): '''opFeatures(obj) ... returns the OR'ed list of features used and supported by the operation.