summaryrefslogtreecommitdiff
path: root/gerbonara/gerber/gerber_statements.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2021-11-06 22:00:14 +0100
committerjaseg <git@jaseg.de>2021-11-06 22:00:14 +0100
commit5aa184757e4fb5c2fc141c41aed2fccc0c96ce7e (patch)
treef2564f7602d6b044880617a1505729d612d83219 /gerbonara/gerber/gerber_statements.py
parent3538398e84b6899a61cfd1e3010c24e1f3098c8f (diff)
downloadgerbonara-5aa184757e4fb5c2fc141c41aed2fccc0c96ce7e.tar.gz
gerbonara-5aa184757e4fb5c2fc141c41aed2fccc0c96ce7e.tar.bz2
gerbonara-5aa184757e4fb5c2fc141c41aed2fccc0c96ce7e.zip
Make unit test not crash on import
Diffstat (limited to 'gerbonara/gerber/gerber_statements.py')
-rw-r--r--gerbonara/gerber/gerber_statements.py25
1 files changed, 2 insertions, 23 deletions
diff --git a/gerbonara/gerber/gerber_statements.py b/gerbonara/gerber/gerber_statements.py
index 22766f8..9296d1b 100644
--- a/gerbonara/gerber/gerber_statements.py
+++ b/gerbonara/gerber/gerber_statements.py
@@ -25,7 +25,7 @@ from .utils import (parse_gerber_value, write_gerber_value, decimal_string,
from .am_statements import *
from .am_read import read_macro
-from .am_eval import eval_macro
+from .am_primitive import eval_macro
from .primitives import AMGroup
@@ -418,33 +418,12 @@ class AMParamStmt(ParamStmt):
self.name = name
self.macro = macro
self.units = units
- self.primitives = list(AMParamStmt._parse_primitives(self.instructions))
+ self.primitives = list(eval_macro(self.instructions))
def read(self, macro):
return read_macro(macro)
@classmethod
- def _parse_primitives(kls, instructions):
- classes = {
- 0: AMCommentPrimitive,
- 1: AMCirclePrimitive,
- 2: AMVectorLinePrimitive,
- 20: AMVectorLinePrimitive,
- 21: AMCenterLinePrimitive,
- 4: AMOutlinePrimitive,
- 5: AMPolygonPrimitive,
- 6: AMMoirePrimitive,
- 7: AMThermalPrimitive,
- }
-
- for code, modifiers in eval_macro(instructions):
- if code < 0:
- yield AMVariableDef(-code, modifiers[0])
- else:
- primitive = classes[code]
- yield primitive.from_modifiers(code, modifiers)
-
- @classmethod
def circle(cls, name, units):
return cls('AM', name, '1,1,$1,0,0,0*1,0,$2,0,0,0', units)