diff options
author | Paulo Henrique Silva <ph.silva@gmail.com> | 2015-12-20 22:15:44 -0200 |
---|---|---|
committer | Paulo Henrique Silva <ph.silva@gmail.com> | 2015-12-20 22:15:44 -0200 |
commit | d1598b46c91ee36719460d49d7ba2ed5ecd0ef45 (patch) | |
tree | 7e107cc196fade05719f0cc6a659f6f17f6a3b3b /gerber/common.py | |
parent | 2e2b4e49c3182cc7385f12d760222ecb57cc1356 (diff) | |
parent | 163a0cd531c667ec666108562eb2dbec28ce6125 (diff) | |
download | gerbonara-d1598b46c91ee36719460d49d7ba2ed5ecd0ef45.tar.gz gerbonara-d1598b46c91ee36719460d49d7ba2ed5ecd0ef45.tar.bz2 gerbonara-d1598b46c91ee36719460d49d7ba2ed5ecd0ef45.zip |
Merge pull request #52 from curtacircuitos/negative_soldermask
Allow negative solder mask rendering per #50.
Diffstat (limited to 'gerber/common.py')
-rw-r--r-- | gerber/common.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gerber/common.py b/gerber/common.py index 1659e3b..f8979dc 100644 --- a/gerber/common.py +++ b/gerber/common.py @@ -17,9 +17,11 @@ from . import rs274x from . import excellon +from .exceptions import ParseError from .utils import detect_file_format + def read(filename): """ Read a gerber or excellon file and return a representative object. @@ -35,14 +37,15 @@ def read(filename): ExcellonFile. Returns None if file is not an Excellon or Gerber file. """ with open(filename, 'rU') as f: - data = f.read() + data = f.read() fmt = detect_file_format(data) if fmt == 'rs274x': return rs274x.read(filename) elif fmt == 'excellon': return excellon.read(filename) else: - raise TypeError('Unable to detect file format') + raise ParseError('Unable to detect file format') + def loads(data): """ Read gerber or excellon file contents from a string and return a @@ -59,7 +62,7 @@ def loads(data): CncFile object representing the file, either GerberFile or ExcellonFile. Returns None if file is not an Excellon or Gerber file. """ - + fmt = detect_file_format(data) if fmt == 'rs274x': return rs274x.loads(data) |