From 7103dfd1a2e022e327abbd3fe30b480c9453f75f Mon Sep 17 00:00:00 2001 From: sliptonic Date: Thu, 17 Feb 2022 12:36:38 -0600 Subject: [PATCH] Merge pull request #5343 from Russ4262/fix/open_edge_zero_start [Path] Fix open edge zero value start point --- src/Mod/Path/PathScripts/PathAreaOp.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathAreaOp.py b/src/Mod/Path/PathScripts/PathAreaOp.py index c0854934a3..e2d1b29a4d 100644 --- a/src/Mod/Path/PathScripts/PathAreaOp.py +++ b/src/Mod/Path/PathScripts/PathAreaOp.py @@ -36,6 +36,7 @@ Part = LazyLoader('Part', globals(), 'Part') if FreeCAD.GuiUp: import FreeCADGui +PathGeom = LazyLoader("PathScripts.PathGeom", globals(), "PathScripts.PathGeom") __title__ = "Base class for PathArea based operations." __author__ = "sliptonic (Brad Collette)" @@ -305,11 +306,18 @@ class ObjectOp(PathOp.ObjectOp): pathParams['preamble'] = False if self.endVector is None: - V = hWire.Wires[0].Vertexes - lv = len(V) - 1 - pathParams['start'] = FreeCAD.Vector(V[0].X, V[0].Y, V[0].Z) - if obj.Direction == 'CCW': - pathParams['start'] = FreeCAD.Vector(V[lv].X, V[lv].Y, V[lv].Z) + 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 PathGeom.isRoughly(x, 0.0): + x = 0.00001 + if PathGeom.isRoughly(y, 0.0): + y = 0.00001 + pathParams["start"] = FreeCAD.Vector(x, y, verts[0].Z) else: pathParams['start'] = self.endVector