summaryrefslogtreecommitdiff
path: root/gerber/gerber_statements.py
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2015-02-02 11:42:47 -0500
committerHamilton Kibbe <hamilton.kibbe@gmail.com>2015-02-02 11:42:47 -0500
commit1cc20b351c10b1fa19817f29edd8c54a27aeee4b (patch)
treec79265c665c37be7d85677836f9b7761a42fa1e9 /gerber/gerber_statements.py
parentd98d23f8b5d61bb9d20e743a3c44bf04b6b2330a (diff)
downloadgerbonara-1cc20b351c10b1fa19817f29edd8c54a27aeee4b.tar.gz
gerbonara-1cc20b351c10b1fa19817f29edd8c54a27aeee4b.tar.bz2
gerbonara-1cc20b351c10b1fa19817f29edd8c54a27aeee4b.zip
tests
Diffstat (limited to 'gerber/gerber_statements.py')
-rw-r--r--gerber/gerber_statements.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/gerber/gerber_statements.py b/gerber/gerber_statements.py
index d84b5e0..0978aca 100644
--- a/gerber/gerber_statements.py
+++ b/gerber/gerber_statements.py
@@ -145,12 +145,14 @@ class MOParamStmt(ParamStmt):
@classmethod
def from_dict(cls, stmt_dict):
param = stmt_dict.get('param')
- if stmt_dict.get('mo').lower() == 'in':
+ if stmt_dict.get('mo') is None:
+ mo = None
+ elif stmt_dict.get('mo').lower() not in ('in', 'mm'):
+ raise ValueError('Mode may be mm or in')
+ elif stmt_dict.get('mo').lower() == 'in':
mo = 'inch'
- elif stmt_dict.get('mo').lower() == 'mm':
- mo = 'metric'
else:
- mo = None
+ mo = 'metric'
return cls(param, mo)
def __init__(self, param, mo):
@@ -347,7 +349,7 @@ class AMOutlinePrimitive(AMPrimitive):
return "{code},{exposure},{n_points},{start_point},{points},{rotation}".format(**data)
-class AMUnsupportPrimitive:
+class AMUnsupportPrimitive(object):
@classmethod
def from_gerber(cls, primitive):
return cls(primitive)
@@ -652,9 +654,9 @@ class OFParamStmt(ParamStmt):
def __str__(self):
offset_str = ''
if self.a is not None:
- offset_str += ('X: %f' % self.a)
+ offset_str += ('X: %f ' % self.a)
if self.b is not None:
- offset_str += ('Y: %f' % self.b)
+ offset_str += ('Y: %f ' % self.b)
return ('<Offset: %s>' % offset_str)