From b8a8cfe1fd360af292065f20802f9f0305b80204 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Fri, 25 May 2018 12:41:17 +0300 Subject: [PATCH] - added support for Gerber files that have apertures with size zero Basically it test the "size" value for the current aperture and if it's found with zero value it will replace with a really small value (0.0000001)that for all practical purposes is "zero" (0.0000001 in inch is really small and in mm is even smaller) - correcting small typos --- camlib.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/camlib.py b/camlib.py index d79b4532..ab070333 100644 --- a/camlib.py +++ b/camlib.py @@ -1006,7 +1006,7 @@ class Geometry(object): def export_svg(self, scale_factor=0.00): """ - Exports the Gemoetry Object as a SVG Element + Exports the Geometry Object as a SVG Element :return: SVG Element """ @@ -1849,7 +1849,7 @@ class Gerber (Geometry): #log.debug("%3s %s" % (line_num, gline)) ### Aperture Macros - # Having this at the beggining will slow things down + # Having this at the beginning will slow things down # but macros can have complicated statements than could # be caught by other patterns. if current_macro is None: # No macro started yet @@ -2228,6 +2228,15 @@ class Gerber (Geometry): log.debug("Line %d: Aperture change to (%s)" % (line_num, match.group(1))) log.debug(self.apertures[current_aperture]) + # If the aperture value is zero then make it something quite small but with a non-zero value + # so it can be processed by FlatCAM. + # But first test to see if the aperture type is "aperture macro". In that case + # we should not test for "size" key as it does not exist in this case. + if self.apertures[current_aperture]["type"] is not "AM": + if self.apertures[current_aperture]["size"] == 0: + self.apertures[current_aperture]["size"] = 0.0000001 + log.debug(self.apertures[current_aperture]) + # Take care of the current path with the previous tool if len(path) > 1: # --- Buffered ---- @@ -2511,7 +2520,6 @@ class Excellon(Geometry): # self.tools[name] = {"C": diameter} self.tools = {} - self.drills = [] ## IN|MM -> Units are inherited from Geometry