From 84f5fe9f7ba59f17c2bed49ca902a0e18c5a6908 Mon Sep 17 00:00:00 2001 From: jffmichi <> Date: Fri, 20 Oct 2023 02:21:27 +0200 Subject: [PATCH] Path: fix Profile open edges not respecting selected cutting direction --- src/Mod/Path/Path/Op/Area.py | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/Mod/Path/Path/Op/Area.py b/src/Mod/Path/Path/Op/Area.py index 1ef2044a8f..34a2c26283 100644 --- a/src/Mod/Path/Path/Op/Area.py +++ b/src/Mod/Path/Path/Op/Area.py @@ -346,21 +346,25 @@ class ObjectOp(PathOp.ObjectOp): # Note that emitting preambles between moves breaks some dressups and prevents path optimization on some controllers pathParams["preamble"] = False - if self.endVector is None: - verts = hWire.Wires[0].Vertexes - idx = 0 - if obj.Direction == "CCW": - idx = len(verts) - 1 - x = verts[idx].X - y = verts[idx].Y - # Zero start value adjustments for Path.fromShapes() bug - if Path.Geom.isRoughly(x, 0.0): - x = 0.00001 - if Path.Geom.isRoughly(y, 0.0): - y = 0.00001 - pathParams["start"] = FreeCAD.Vector(x, y, verts[0].Z) - else: - pathParams["start"] = self.endVector + # Always manually setting pathParams["start"] to the first or + # last vertex of the wire (depending on obj.Direction) ensures + # the edge is always milled in the correct direction. Using + # self.endVector would allow Path.fromShapes to reverse the + # direction if that would shorten the travel move and thus cause + # the edges being milled in seemingly random directions. + + verts = hWire.Wires[0].Vertexes + idx = 0 + if obj.Direction == "CCW": + idx = len(verts) - 1 + x = verts[idx].X + y = verts[idx].Y + # Zero start value adjustments for Path.fromShapes() bug + if Path.Geom.isRoughly(x, 0.0): + x = 0.00001 + if Path.Geom.isRoughly(y, 0.0): + y = 0.00001 + pathParams["start"] = FreeCAD.Vector(x, y, verts[0].Z) obj.PathParams = str( {key: value for key, value in pathParams.items() if key != "shapes"}