From 242f4033c661d70c0d2722050370307f4d9b678a Mon Sep 17 00:00:00 2001 From: jaseg Date: Sat, 22 Jan 2022 19:26:48 +0100 Subject: Make excellon tests pass --- gerbonara/gerber/aperture_macros/parse.py | 6 +++--- gerbonara/gerber/aperture_macros/primitive.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'gerbonara/gerber/aperture_macros') diff --git a/gerbonara/gerber/aperture_macros/parse.py b/gerbonara/gerber/aperture_macros/parse.py index 43af309..c1aa2d0 100644 --- a/gerbonara/gerber/aperture_macros/parse.py +++ b/gerbonara/gerber/aperture_macros/parse.py @@ -121,10 +121,10 @@ class ApertureMacro: def to_graphic_primitives(self, offset, rotation, parameters : [float], unit=None): variables = dict(self.variables) - for number, value in enumerate(parameters): - if i in variables: + for number, value in enumerate(parameters, start=1): + if number in variables: raise SyntaxError(f'Re-definition of aperture macro variable {i} through parameter {value}') - variables[i] = value + variables[number] = value for primitive in self.primitives: yield from primitive.to_graphic_primitives(offset, rotation, variables, unit) diff --git a/gerbonara/gerber/aperture_macros/primitive.py b/gerbonara/gerber/aperture_macros/primitive.py index 4de19c4..76268d2 100644 --- a/gerbonara/gerber/aperture_macros/primitive.py +++ b/gerbonara/gerber/aperture_macros/primitive.py @@ -232,9 +232,9 @@ class Outline(Primitive): bound_radii = [None] * len(bound_coords) rotation += deg_to_rad(calc.rotation) - bound_coords = [ rotate_point(*p, rotation, 0, 0) for p in bound_coords ] + bound_coords = [ gp.rotate_point(*p, rotation, 0, 0) for p in bound_coords ] - return gp.ArcPoly(bound_coords, bound_radii, polarity_dark=calc.exposure) + return [gp.ArcPoly(bound_coords, bound_radii, polarity_dark=calc.exposure)] def dilate(self, offset, unit): # we would need a whole polygon offset/clipping library here -- cgit