From 66929a82db54824240ee5357eef3b446355d091e Mon Sep 17 00:00:00 2001 From: Juan Pablo Caram Date: Fri, 21 Nov 2014 10:43:00 -0500 Subject: [PATCH] Fixed gerber parser for 360 deg. arcs. --- camlib.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/camlib.py b/camlib.py index 514a3fa5..31f57696 100644 --- a/camlib.py +++ b/camlib.py @@ -1,6 +1,6 @@ ############################################################ # FlatCAM: 2D Post-processing for Manufacturing # -# http://caram.cl/software/flatcam # +# http://flatcam.org # # Author: Juan Pablo Caram (c) # # Date: 2/5/2014 # # MIT Licence # @@ -1226,7 +1226,14 @@ class Gerber (Geometry): center = [i + current_x, j + current_y] radius = sqrt(i**2 + j**2) start = arctan2(-j, -i) # Start angle - stop = arctan2(-center[1] + y, -center[0] + x) # Stop angle + # Numerical errors might prevent start == stop therefore + # we check ahead of time. This should result in a + # 360 degree arc. + if current_x == x and current_y == y: + stop = start + else: + stop = arctan2(-center[1] + y, -center[0] + x) # Stop angle + this_arc = arc(center, radius, start, stop, arcdir[current_interpolation_mode], self.steps_per_circ) @@ -1243,7 +1250,6 @@ class Gerber (Geometry): continue if quadrant_mode == 'SINGLE': - #log.warning("Single quadrant arc are not implemented yet. (%d)" % line_num) center_candidates = [ [i + current_x, j + current_y],