From 803c136968c6b8974b0cb4ec31dae3816bb9fbd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCdepohl?= Date: Sun, 19 Jun 2016 23:06:24 +0200 Subject: [PATCH] Path: Fix spurious full circles in PathProfile 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. --- src/Mod/Path/PathScripts/PathUtils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Mod/Path/PathScripts/PathUtils.py b/src/Mod/Path/PathScripts/PathUtils.py index e3fddee7d..5fa057cf5 100644 --- a/src/Mod/Path/PathScripts/PathUtils.py +++ b/src/Mod/Path/PathScripts/PathUtils.py @@ -240,6 +240,16 @@ def convert(toolpath, Z=0.0, PlungeAngle=90.0, Zprevious=None, StopLength=None, 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")