Skip to content

Commit

Permalink
Path: Fix spurious full circles in PathProfile
Browse files Browse the repository at this point in the history
There was an issue in the conversion from a toolpath to GCode, some very
small circles were mistaken for full circles when their coordinates were
output in some finite precision.
  • Loading branch information
lhuedepohl authored and wwmayer committed Jul 15, 2016
1 parent b4c084d commit 803c136
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Mod/Path/PathScripts/PathUtils.py
Expand Up @@ -240,6 +240,16 @@ def edge_to_path(lastpt, edge, Z):
endpt = arcstartpt
center = edge.Curve.Center
relcenter = center.sub(lastpt)

# start point and end point fall together in the given output precision?
if fmt(startpt.x) == fmt(endpt.x) and fmt(startpt.y) == fmt(endpt.y):
if edge.Length < 0.5 * 2 * math.pi * edge.Curve.Radius:
# because it is a very small circle -> omit, as that gcode would produce a full circle
return endpt, ""
else:
# it is an actual full circle, emit a line for this
pass

# FreeCAD.Console.PrintMessage("arc startpt= " + str(startpt)+ "\n")
# FreeCAD.Console.PrintMessage("arc midpt= " + str(midpt)+ "\n")
# FreeCAD.Console.PrintMessage("arc endpt= " + str(endpt)+ "\n")
Expand Down

0 comments on commit 803c136

Please sign in to comment.