Merged in marius_stanciu/flatcam_mpl/load_gerber_with_zero_value (pull request #83)

Support for Gerber files that have apertures with size zero
This commit is contained in:
Marius Stanciu 2018-06-04 16:56:22 +00:00 committed by jpcgt
commit d4331b49bc
1 changed files with 11 additions and 3 deletions

View File

@ -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<float>}
self.tools = {}
self.drills = []
## IN|MM -> Units are inherited from Geometry