diff options
author | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2014-10-08 09:27:52 -0400 |
---|---|---|
committer | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2014-10-08 09:27:52 -0400 |
commit | 1653ae5cbe88757e453bccf499dc1b8ccb278e58 (patch) | |
tree | b80b610fb0c5c52c91edbe753947daeb0e39db20 /gerber/excellon.py | |
parent | 100ab899ed7a1a49c3401b87b7d6b0f53a043dbc (diff) | |
download | gerbonara-1653ae5cbe88757e453bccf499dc1b8ccb278e58.tar.gz gerbonara-1653ae5cbe88757e453bccf499dc1b8ccb278e58.tar.bz2 gerbonara-1653ae5cbe88757e453bccf499dc1b8ccb278e58.zip |
Update readme and example
Diffstat (limited to 'gerber/excellon.py')
-rwxr-xr-x | gerber/excellon.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/gerber/excellon.py b/gerber/excellon.py index 66b9ea2..663f791 100755 --- a/gerber/excellon.py +++ b/gerber/excellon.py @@ -67,15 +67,13 @@ class ExcellonFile(CncFile): """
pass
- def render(self, filename, ctx):
+ def render(self, ctx, filename=None):
""" Generate image of file
"""
- count = 0
for tool, pos in self.hits:
ctx.drill(pos[0], pos[1], tool.diameter)
- count += 1
- print('Drilled %d hits' % count)
- ctx.dump(filename)
+ if filename is not None:
+ ctx.dump(filename)
def write(self, filename):
with open(filename, 'w') as f:
@@ -86,8 +84,7 @@ class ExcellonFile(CncFile): class ExcellonParser(object):
""" Excellon File Parser
"""
- def __init__(self, ctx=None):
- self.ctx = ctx
+ def __init__(self):
self.notation = 'absolute'
self.units = 'inch'
self.zero_suppression = 'trailing'
@@ -197,8 +194,3 @@ class ExcellonParser(object): return FileSettings(units=self.units, format=self.format,
zero_suppression=self.zero_suppression,
notation=self.notation)
-
-
-if __name__ == '__main__':
- p = ExcellonParser()
- parsed = p.parse('examples/ncdrill.txt')
|