diff options
author | jaseg <git@jaseg.de> | 2022-01-30 15:58:20 +0100 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2022-01-30 15:58:20 +0100 |
commit | fd9e0d00792256aed5c30d13abf894df31a357c4 (patch) | |
tree | 4ba1fad9473e881bf21cec36ceca3d9958c10ba1 /gerbonara/gerber/rs274x.py | |
parent | c8bf837a4b5dcc6242b7dac383f09e9390deca35 (diff) | |
download | gerbonara-fd9e0d00792256aed5c30d13abf894df31a357c4.tar.gz gerbonara-fd9e0d00792256aed5c30d13abf894df31a357c4.tar.bz2 gerbonara-fd9e0d00792256aed5c30d13abf894df31a357c4.zip |
Fix aperture macro outline primitive rendering
Diffstat (limited to 'gerbonara/gerber/rs274x.py')
-rw-r--r-- | gerbonara/gerber/rs274x.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gerbonara/gerber/rs274x.py b/gerbonara/gerber/rs274x.py index d3719b3..8bd622b 100644 --- a/gerbonara/gerber/rs274x.py +++ b/gerbonara/gerber/rs274x.py @@ -369,10 +369,11 @@ class GraphicsState: self.unit_warning = True attrs = attrs or {} self.update_point(x, y) - return go.Flash(*self.map_coord(*self.point), self.aperture, + obj = go.Flash(*self.map_coord(*self.point), self.aperture, polarity_dark=self.polarity_dark, unit=self.file_settings.unit, attrs=attrs) + return obj def interpolate(self, x, y, i=None, j=None, aperture=True, multi_quadrant=False, attrs=None): if self.point is None: @@ -737,6 +738,7 @@ class GerberParser: def _parse_aperture_definition(self, match): # number, shape, modifiers modifiers = [ float(val) for val in match['modifiers'].strip(' ,').split('X') ] if match['modifiers'] else [] + number = int(match['number']) aperture_classes = { 'C': apertures.CircleAperture, @@ -752,15 +754,17 @@ class GerberParser: if match['shape'] in 'RO' and (math.isclose(modifiers[0], 0) or math.isclose(modifiers[1], 0)): self.warn('Definition of zero-width and/or zero-height rectangle or obround aperture. This is invalid according to spec.' ) - new_aperture = kls(*modifiers, unit=self.file_settings.unit, attrs=self.aperture_attrs.copy()) + new_aperture = kls(*modifiers, unit=self.file_settings.unit, attrs=self.aperture_attrs.copy(), + original_number=number) elif (macro := self.aperture_macros.get(match['shape'])): - new_aperture = apertures.ApertureMacroInstance(macro, modifiers, unit=self.file_settings.unit, attrs=self.aperture_attrs.copy()) + new_aperture = apertures.ApertureMacroInstance(macro, modifiers, unit=self.file_settings.unit, + attrs=self.aperture_attrs.copy(), original_number=number) else: raise ValueError(f'Aperture shape "{match["shape"]}" is unknown') - self.aperture_map[int(match['number'])] = new_aperture + self.aperture_map[number] = new_aperture def _parse_aperture_macro(self, match): self.aperture_macros[match['name']] = ApertureMacro.parse_macro( |