summaryrefslogtreecommitdiff
path: root/gerbonara/rs274x.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-04-04 19:06:04 +0200
committerjaseg <git@jaseg.de>2023-04-10 23:57:15 +0200
commit07b2628dbb08de7120ef3c760cd91f0d8901fe73 (patch)
treeb640afbcf0da447185e72f572e373149f4aff079 /gerbonara/rs274x.py
parent387ff3de76664e620afebb6dabbccc0424710546 (diff)
downloadgerbonara-07b2628dbb08de7120ef3c760cd91f0d8901fe73.tar.gz
gerbonara-07b2628dbb08de7120ef3c760cd91f0d8901fe73.tar.bz2
gerbonara-07b2628dbb08de7120ef3c760cd91f0d8901fe73.zip
Various convenience improvements, and make board name guessing really smart
Diffstat (limited to 'gerbonara/rs274x.py')
-rw-r--r--gerbonara/rs274x.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/gerbonara/rs274x.py b/gerbonara/rs274x.py
index 6620f10..271880b 100644
--- a/gerbonara/rs274x.py
+++ b/gerbonara/rs274x.py
@@ -73,6 +73,9 @@ class GerberFile(CamFile):
self.apertures = [] # FIXME get rid of this? apertures are already in the objects.
self.file_attrs = file_attrs or {}
+ def sync_apertures(self):
+ self.apertures = list({id(obj.aperture): obj.aperture for obj in self.objects if hasattr(obj, 'aperture')}.values())
+
def to_excellon(self, plated=None, errors='raise'):
""" Convert this excellon file into a :py:class:`~.excellon.ExcellonFile`. This will convert interpolated lines
into slots, and circular aperture flashes into holes. Other features such as ``G36`` polygons or flashes with
@@ -227,6 +230,8 @@ class GerberFile(CamFile):
def _generate_statements(self, settings, drop_comments=True):
""" Export this file as Gerber code, yields one str per line. """
+ self.sync_apertures()
+
yield 'G04 Gerber file generated by Gerbonara*'
for name, value in self.file_attrs.items():
attrdef = ','.join([name, *map(str, value)])