summaryrefslogtreecommitdiff
path: root/gerber/excellon.py
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2016-07-17 10:42:03 +0800
committerGarret Fick <garret@ficksworkshop.com>2016-07-17 10:42:03 +0800
commit0dded38353e1d650458f6401aea37a4aadaf28ff (patch)
treea297c26c7cbb6b1c7d7a9cbe4eb4639b203fba53 /gerber/excellon.py
parentd0e9018da0d7c51c2195f641c9189f85378df3e8 (diff)
parentd1598b46c91ee36719460d49d7ba2ed5ecd0ef45 (diff)
downloadgerbonara-0dded38353e1d650458f6401aea37a4aadaf28ff.tar.gz
gerbonara-0dded38353e1d650458f6401aea37a4aadaf28ff.tar.bz2
gerbonara-0dded38353e1d650458f6401aea37a4aadaf28ff.zip
Merge in negative soldermask. Still required further changes to support negatives for shapes that dont exist in the merge source
Diffstat (limited to 'gerber/excellon.py')
-rwxr-xr-xgerber/excellon.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/gerber/excellon.py b/gerber/excellon.py
index 430ee7d..a0bad4f 100755
--- a/gerber/excellon.py
+++ b/gerber/excellon.py
@@ -26,16 +26,18 @@ This module provides Excellon file classes and parsing utilities
import math
import operator
+from .cam import CamFile, FileSettings
+from .excellon_statements import *
+from .excellon_tool import ExcellonToolDefinitionParser
+from .primitives import Drill, Slot
+from .utils import inch, metric
+
+
try:
from cStringIO import StringIO
except(ImportError):
from io import StringIO
-from .excellon_statements import *
-from .excellon_tool import ExcellonToolDefinitionParser
-from .cam import CamFile, FileSettings
-from .primitives import Drill, Slot
-from .utils import inch, metric
def read(filename):
@@ -56,8 +58,8 @@ def read(filename):
data = f.read()
settings = FileSettings(**detect_excellon_format(data))
return ExcellonParser(settings).parse(filename)
-
-def loads(data, settings = None, tools = None):
+
+def loads(data, settings = None, tools = None):
""" Read data from string and return an ExcellonFile
Parameters
----------
@@ -402,13 +404,13 @@ class ExcellonParser(object):
def parse_raw(self, data, filename=None):
for line in StringIO(data):
- self._parse(line.strip())
+ self._parse_line(line.strip())
for stmt in self.statements:
stmt.units = self.units
return ExcellonFile(self.statements, self.tools, self.hits,
self._settings(), filename)
- def _parse(self, line):
+ def _parse_line(self, line):
# skip empty lines
if not line.strip():
return
@@ -599,7 +601,7 @@ class ExcellonParser(object):
elif line[0] == 'T' and self.state != 'HEADER':
stmt = ToolSelectionStmt.from_excellon(line)
self.statements.append(stmt)
-
+
# T0 is used as END marker, just ignore
if stmt.tool != 0:
tool = self._get_tool(stmt.tool)