From 9ffc96cbe53eb0335f8a379252fb8124acaf5346 Mon Sep 17 00:00:00 2001 From: jaseg Date: Sun, 30 Apr 2023 01:44:58 +0200 Subject: Finish macro-based alio layout --- gerbonara/aperture_macros/parse.py | 2 +- gerbonara/aperture_macros/primitive.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'gerbonara/aperture_macros') diff --git a/gerbonara/aperture_macros/parse.py b/gerbonara/aperture_macros/parse.py index a4c2956..5dda931 100644 --- a/gerbonara/aperture_macros/parse.py +++ b/gerbonara/aperture_macros/parse.py @@ -111,7 +111,7 @@ class ApertureMacro: def to_gerber(self, unit=None): comments = [ str(c) for c in self.comments ] - variable_defs = [ f'${var}={expr}' for var, expr in enumerate(self.variables, start=1) if expr is not None ] + variable_defs = [ f'${var}={str(expr)[1:-1]}' for var, expr in enumerate(self.variables, start=1) if expr is not None ] primitive_defs = [ prim.to_gerber(unit) for prim in self.primitives ] return '*\n'.join(comments + variable_defs + primitive_defs) diff --git a/gerbonara/aperture_macros/primitive.py b/gerbonara/aperture_macros/primitive.py index 38bd266..a12a33c 100644 --- a/gerbonara/aperture_macros/primitive.py +++ b/gerbonara/aperture_macros/primitive.py @@ -48,7 +48,7 @@ class Primitive: def to_gerber(self, unit=None): return f'{self.code},' + ','.join( - getattr(self, name).to_gerber(unit) for name in type(self).__annotations__) + getattr(self, field.name).to_gerber(unit) for field in fields(self) if field.name != 'unit') def __str__(self): attrs = ','.join(str(getattr(self, name)).strip('<>') for name in type(self).__annotations__) -- cgit