summaryrefslogtreecommitdiff
path: root/gerber/excellon_statements.py
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2016-01-31 14:17:35 +0800
committerGarret Fick <garret@ficksworkshop.com>2016-01-31 14:17:35 +0800
commite84f131720e5952ba0dc20de8729bfd1d7aa0fe7 (patch)
treedcecbfd0e96d437aa45b30206ce606daa96985d1 /gerber/excellon_statements.py
parent60784dfa2107f72fcaeed739b835d647e4c3a7a9 (diff)
downloadgerbonara-e84f131720e5952ba0dc20de8729bfd1d7aa0fe7.tar.gz
gerbonara-e84f131720e5952ba0dc20de8729bfd1d7aa0fe7.tar.bz2
gerbonara-e84f131720e5952ba0dc20de8729bfd1d7aa0fe7.zip
Add support for more excellon formats. Dont consider line width when determinging region bounding box
Diffstat (limited to 'gerber/excellon_statements.py')
-rw-r--r--gerber/excellon_statements.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/gerber/excellon_statements.py b/gerber/excellon_statements.py
index e10308a..d2ba233 100644
--- a/gerber/excellon_statements.py
+++ b/gerber/excellon_statements.py
@@ -601,14 +601,24 @@ class UnitStmt(ExcellonStatement):
def from_excellon(cls, line, **kwargs):
units = 'inch' if 'INCH' in line else 'metric'
zeros = 'leading' if 'LZ' in line else 'trailing'
- return cls(units, zeros, **kwargs)
+ if '0000.00' in line:
+ format = (4, 2)
+ elif '000.000' in line:
+ format = (3, 3)
+ elif '00.0000' in line:
+ format = (2, 4)
+ else:
+ format = None
+ return cls(units, zeros, format, **kwargs)
- def __init__(self, units='inch', zeros='leading', **kwargs):
+ def __init__(self, units='inch', zeros='leading', format=None, **kwargs):
super(UnitStmt, self).__init__(**kwargs)
self.units = units.lower()
self.zeros = zeros
+ self.format = format
def to_excellon(self, settings=None):
+ # TODO This won't export the invalid format statement if it exists
stmt = '%s,%s' % ('INCH' if self.units == 'inch' else 'METRIC',
'LZ' if self.zeros == 'leading'
else 'TZ')