summaryrefslogtreecommitdiff
path: root/gerber/excellon_statements.py
diff options
context:
space:
mode:
authorHamilton Kibbe <ham@hamiltonkib.be>2014-10-07 18:36:03 -0400
committerHamilton Kibbe <ham@hamiltonkib.be>2014-10-07 18:36:03 -0400
commitb971dacd3f058772326a479a562ceed0a9594deb (patch)
tree6f2632ae3c5d99951fa4d320250ade26360ffee5 /gerber/excellon_statements.py
parent8ac771db92633fab9aa0ff9ecc7333e6a412e577 (diff)
downloadgerbonara-b971dacd3f058772326a479a562ceed0a9594deb.tar.gz
gerbonara-b971dacd3f058772326a479a562ceed0a9594deb.tar.bz2
gerbonara-b971dacd3f058772326a479a562ceed0a9594deb.zip
more tests
Diffstat (limited to 'gerber/excellon_statements.py')
-rw-r--r--gerber/excellon_statements.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/gerber/excellon_statements.py b/gerber/excellon_statements.py
index 13f763e..5eba12c 100644
--- a/gerber/excellon_statements.py
+++ b/gerber/excellon_statements.py
@@ -331,10 +331,10 @@ class IncrementalModeStmt(ExcellonStatement):
def __init__(self, mode='off'):
if mode.lower() not in ['on', 'off']:
raise ValueError('Mode may be "on" or "off"')
- self.mode = 'off'
+ self.mode = mode
def to_excellon(self):
- return 'ICI,%s' % 'OFF' if self.mode == 'off' else 'ON'
+ return 'ICI,%s' % ('OFF' if self.mode == 'off' else 'ON')
class VersionStmt(ExcellonStatement):
@@ -361,14 +361,14 @@ class FormatStmt(ExcellonStatement):
fmt = int(line.split(',')[1])
return cls(fmt)
- def __init__(self, nformat=1):
- nformat = int(nformat)
- if nformat not in [1, 2]:
+ def __init__(self, format=1):
+ format = int(format)
+ if format not in [1, 2]:
raise ValueError('Valid formats are 1 or 2')
- self.nformat = nformat
+ self.format = format
def to_excellon(self):
- return 'FMAT,%d' % self.n
+ return 'FMAT,%d' % self.format
class LinkToolStmt(ExcellonStatement):
@@ -389,6 +389,8 @@ class MeasuringModeStmt(ExcellonStatement):
@classmethod
def from_excellon(cls, line):
+ if not ('M71' in line or 'M72' in line):
+ raise ValueError('Not a measuring mode statement')
return cls('inch') if 'M72' in line else cls('metric')
def __init__(self, units='inch'):