Merge pull request #11108 from jffmichi/fix_profile_open_edge_direction

Path: fix Profile open edges not respecting selected cutting direction
This commit is contained in:
sliptonic
2023-10-23 18:25:03 -05:00
committed by GitHub

View File

@@ -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"}