summaryrefslogtreecommitdiff
path: root/gerbonara/aperture_macros/parse.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-04-30 01:26:21 +0200
committerjaseg <git@jaseg.de>2023-04-30 01:26:21 +0200
commitfda243315434f8cc4c21498a1dcb2c37ad39d268 (patch)
treec097ea9b3c50bc530821d6f2a2995f5b53af433c /gerbonara/aperture_macros/parse.py
parentf674f5d9af814bac3226202b1e911acc083118ca (diff)
downloadgerbonara-fda243315434f8cc4c21498a1dcb2c37ad39d268.tar.gz
gerbonara-fda243315434f8cc4c21498a1dcb2c37ad39d268.tar.bz2
gerbonara-fda243315434f8cc4c21498a1dcb2c37ad39d268.zip
Alio macros WIP
Diffstat (limited to 'gerbonara/aperture_macros/parse.py')
-rw-r--r--gerbonara/aperture_macros/parse.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/gerbonara/aperture_macros/parse.py b/gerbonara/aperture_macros/parse.py
index b8970ff..a4c2956 100644
--- a/gerbonara/aperture_macros/parse.py
+++ b/gerbonara/aperture_macros/parse.py
@@ -111,12 +111,12 @@ class ApertureMacro:
def to_gerber(self, unit=None):
comments = [ str(c) for c in self.comments ]
- variable_defs = [ f'${var.to_gerber(unit)}={expr}' for var, expr in enumerate(self.variables, start=1) ]
+ variable_defs = [ f'${var}={expr}' 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)
def to_graphic_primitives(self, offset, rotation, parameters : [float], unit=None, polarity_dark=True):
- variables = {i: v for i, v in enumerate(self.variables, start=1)}
+ variables = {i: v for i, v in enumerate(self.variables, start=1) if v is not None}
for number, value in enumerate(parameters, start=1):
if number in variables:
raise SyntaxError(f'Re-definition of aperture macro variable {number} through parameter {value}')