diff options
author | Garret Fick <garret@ficksworkshop.com> | 2016-03-24 00:10:34 +0800 |
---|---|---|
committer | Garret Fick <garret@ficksworkshop.com> | 2016-03-24 00:10:34 +0800 |
commit | d12f6385a434c02677bfbb7b075dd9d8e49627fe (patch) | |
tree | 3b5d96eae1d4e57d63a8b4220300c7b21a0ffaa1 /gerber/excellon_statements.py | |
parent | a6c186245075efa2af2acf7b736a1c8f0d0d90f6 (diff) | |
download | gerbonara-d12f6385a434c02677bfbb7b075dd9d8e49627fe.tar.gz gerbonara-d12f6385a434c02677bfbb7b075dd9d8e49627fe.tar.bz2 gerbonara-d12f6385a434c02677bfbb7b075dd9d8e49627fe.zip |
Basic rendering of excellon works, but still has issues
Diffstat (limited to 'gerber/excellon_statements.py')
-rw-r--r-- | gerber/excellon_statements.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/gerber/excellon_statements.py b/gerber/excellon_statements.py index 18eaea1..cabdf6c 100644 --- a/gerber/excellon_statements.py +++ b/gerber/excellon_statements.py @@ -116,6 +116,21 @@ class ExcellonTool(ExcellonStatement): PLATED_YES = 'plated' PLATED_NO = 'nonplated' PLATED_OPTIONAL = 'optional' + + @classmethod + def from_tool(cls, tool): + args = {} + + args['depth_offset'] = tool.depth_offset + args['diameter'] = tool.diameter + args['feed_rate'] = tool.feed_rate + args['max_hit_count'] = tool.max_hit_count + args['number'] = tool.number + args['plated'] = tool.plated + args['retract_rate'] = tool.retract_rate + args['rpm'] = tool.rpm + + return cls(None, **args) @classmethod def from_excellon(cls, line, settings, id=None, plated=None): @@ -196,8 +211,10 @@ class ExcellonTool(ExcellonStatement): self.hit_count = 0 def to_excellon(self, settings=None): - fmt = self.settings.format - zs = self.settings.zero_suppression + if self.settings and not settings: + settings = self.settings + fmt = settings.format + zs = settings.zero_suppression stmt = 'T%02d' % self.number if self.retract_rate is not None: stmt += 'B%s' % write_gerber_value(self.retract_rate, fmt, zs) |