From 9ab4ec360c9028122648a881516ce5ed8ae63f77 Mon Sep 17 00:00:00 2001 From: Paulo Henrique Silva Date: Tue, 7 Apr 2015 18:24:47 -0300 Subject: Fix parsing for AM macros with zero modifiers --- gerber/gerber_statements.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gerber') diff --git a/gerber/gerber_statements.py b/gerber/gerber_statements.py index 39cecf2..4e5ed77 100644 --- a/gerber/gerber_statements.py +++ b/gerber/gerber_statements.py @@ -289,7 +289,7 @@ class ADParamStmt(ParamStmt): ParamStmt.__init__(self, param) self.d = d self.shape = shape - if modifiers is not None: + if modifiers: self.modifiers = [tuple([float(x) for x in m.split("X")]) for m in modifiers.split(",") if len(m)] else: self.modifiers = [] @@ -301,7 +301,7 @@ class ADParamStmt(ParamStmt): self.modifiers = [tuple([metric(x) for x in modifier]) for modifier in self.modifiers] def to_gerber(self, settings=None): - if len(self.modifiers): + if any(self.modifiers): return '%ADD{0}{1},{2}*%'.format(self.d, self.shape, ','.join(['X'.join(["%.4g" % x for x in modifier]) for modifier in self.modifiers])) else: return '%ADD{0}{1}*%'.format(self.d, self.shape) -- cgit