summaryrefslogtreecommitdiff
path: root/gerber/gerber_statements.py
diff options
context:
space:
mode:
authorPaulo Henrique Silva <ph.silva@gmail.com>2015-03-05 14:43:30 -0300
committerPaulo Henrique Silva <ph.silva@gmail.com>2015-03-05 14:43:30 -0300
commita13b981c1c2ea9ede39e9821d9ba818566f044de (patch)
treed7e1507bd389623e077da0d497b419edcfd9e53f /gerber/gerber_statements.py
parent670d3fbbd7ebfb69bd223ac30b73ec47b195b380 (diff)
downloadgerbonara-a13b981c1c2ea9ede39e9821d9ba818566f044de.tar.gz
gerbonara-a13b981c1c2ea9ede39e9821d9ba818566f044de.tar.bz2
gerbonara-a13b981c1c2ea9ede39e9821d9ba818566f044de.zip
Fix tests for macros with no variables.
All AM*Primitive classes now handles float for all but the code modifiers. This simplifies the reading/parsing.
Diffstat (limited to 'gerber/gerber_statements.py')
-rw-r--r--gerber/gerber_statements.py27
1 files changed, 13 insertions, 14 deletions
diff --git a/gerber/gerber_statements.py b/gerber/gerber_statements.py
index 19c7138..99672de 100644
--- a/gerber/gerber_statements.py
+++ b/gerber/gerber_statements.py
@@ -350,31 +350,30 @@ class AMParamStmt(ParamStmt):
def read(self, macro):
return read_macro(macro)
- def evaluate(self, modifiers=[]):
- primitives = []
+ def build(self, modifiers=[[]]):
+ self.primitives = []
+
for primitive in eval_macro(self.instructions, modifiers[0]):
if primitive[0] == '0':
- primitives.append(AMCommentPrimitive.from_gerber(primitive))
+ self.primitives.append(AMCommentPrimitive.from_gerber(primitive))
elif primitive[0] == '1':
- primitives.append(AMCirclePrimitive.from_gerber(primitive))
+ self.primitives.append(AMCirclePrimitive.from_gerber(primitive))
elif primitive[0:2] in ('2,', '20'):
- primitives.append(AMVectorLinePrimitive.from_gerber(primitive))
+ self.primitives.append(AMVectorLinePrimitive.from_gerber(primitive))
elif primitive[0:2] == '21':
- primitives.append(AMCenterLinePrimitive.from_gerber(primitive))
+ self.primitives.append(AMCenterLinePrimitive.from_gerber(primitive))
elif primitive[0:2] == '22':
- primitives.append(AMLowerLeftLinePrimitive.from_gerber(primitive))
+ self.primitives.append(AMLowerLeftLinePrimitive.from_gerber(primitive))
elif primitive[0] == '4':
- primitives.append(AMOutlinePrimitive.from_gerber(primitive))
+ self.primitives.append(AMOutlinePrimitive.from_gerber(primitive))
elif primitive[0] == '5':
- primitives.append(AMPolygonPrimitive.from_gerber(primitive))
+ self.primitives.append(AMPolygonPrimitive.from_gerber(primitive))
elif primitive[0] =='6':
- primitives.append(AMMoirePrimitive.from_gerber(primitive))
+ self.primitives.append(AMMoirePrimitive.from_gerber(primitive))
elif primitive[0] == '7':
- primitives.append(AMThermalPrimitive.from_gerber(primitive))
+ self.primitives.append(AMThermalPrimitive.from_gerber(primitive))
else:
- primitives.append(AMUnsupportPrimitive.from_gerber(primitive))
-
- return primitives
+ self.primitives.append(AMUnsupportPrimitive.from_gerber(primitive))
def to_inch(self):
for primitive in self.primitives: