summaryrefslogtreecommitdiff
path: root/gerber
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2016-07-10 15:41:31 +0800
committerGarret Fick <garret@ficksworkshop.com>2016-07-10 15:41:31 +0800
commit7e06f3a2f5870d4878f25e391372285263fe5ac6 (patch)
treec90e299793af56cc0e4c7c233e97cee6f471cd16 /gerber
parent9b0d3b1122ffc3b7c2211b0cdc2cb6de6be9b242 (diff)
downloadgerbonara-7e06f3a2f5870d4878f25e391372285263fe5ac6.tar.gz
gerbonara-7e06f3a2f5870d4878f25e391372285263fe5ac6.tar.bz2
gerbonara-7e06f3a2f5870d4878f25e391372285263fe5ac6.zip
Workaround for bad excellon files that don't correctly set the mode
Diffstat (limited to 'gerber')
-rwxr-xr-xgerber/excellon.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/gerber/excellon.py b/gerber/excellon.py
index a0a639e..becf82d 100755
--- a/gerber/excellon.py
+++ b/gerber/excellon.py
@@ -665,19 +665,21 @@ class ExcellonParser(object):
if y is not None:
self.pos[1] += y
- if self.state == 'DRILL':
+ if self.state == 'LINEAR' and self.drill_down:
+ if not self.active_tool:
+ self.active_tool = self._get_tool(1)
+
+ self.hits.append(DrillSlot(self.active_tool, start, tuple(self.pos), DrillSlot.TYPE_ROUT))
+
+ elif self.state == 'DRILL' or self.state == 'HEADER':
+ # Yes, drills in the header doesn't follow the specification, but it there are many
+ # files like this
if not self.active_tool:
self.active_tool = self._get_tool(1)
self.hits.append(DrillHit(self.active_tool, tuple(self.pos)))
self.active_tool._hit()
- elif self.state == 'LINEAR' and self.drill_down:
- if not self.active_tool:
- self.active_tool = self._get_tool(1)
-
- self.hits.append(DrillSlot(self.active_tool, start, tuple(self.pos), DrillSlot.TYPE_ROUT))
-
else:
self.statements.append(UnknownStmt.from_excellon(line))