diff options
author | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2015-02-20 22:24:34 -0500 |
---|---|---|
committer | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2015-02-20 22:24:34 -0500 |
commit | b3e0ceb5c3ec755b09d2f005b8e3dcbed22d45a1 (patch) | |
tree | 6609c493fbfa7557ebaef0c43f46c61a8b83cf87 /gerber/cam.py | |
parent | b3e816466c9cd514854efd42803cb4258e4956b2 (diff) | |
download | gerbonara-b3e0ceb5c3ec755b09d2f005b8e3dcbed22d45a1.tar.gz gerbonara-b3e0ceb5c3ec755b09d2f005b8e3dcbed22d45a1.tar.bz2 gerbonara-b3e0ceb5c3ec755b09d2f005b8e3dcbed22d45a1.zip |
Add IPC-D-356 Netlist Parsing
Diffstat (limited to 'gerber/cam.py')
-rw-r--r-- | gerber/cam.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gerber/cam.py b/gerber/cam.py index 243070d..31b6d2f 100644 --- a/gerber/cam.py +++ b/gerber/cam.py @@ -53,7 +53,8 @@ class FileSettings(object): and vice versa """ def __init__(self, notation='absolute', units='inch', - zero_suppression=None, format=(2, 5), zeros=None): + zero_suppression=None, format=(2, 5), zeros=None, + angle_units='degrees'): if notation not in ['absolute', 'incremental']: raise ValueError('Notation must be either absolute or incremental') self.notation = notation @@ -84,6 +85,10 @@ class FileSettings(object): raise ValueError('Format must be a tuple(n=2) of integers') self.format = format + if angle_units not in ('degrees', 'radians'): + raise ValueError('Angle units may be degrees or radians') + self.angle_units = angle_units + @property def zero_suppression(self): return self._zero_suppression @@ -114,6 +119,8 @@ class FileSettings(object): return self.zeros elif key == 'format': return self.format + elif key == 'angle_units': + return self.angle_units else: raise KeyError() @@ -144,6 +151,11 @@ class FileSettings(object): raise ValueError('Format must be a tuple(n=2) of integers') self.format = value + elif key == 'angle_units': + if value not in ('degrees', 'radians'): + raise ValueError('Angle units may be degrees or radians') + self.angle_units = value + else: raise KeyError('%s is not a valid key' % key) @@ -151,7 +163,8 @@ class FileSettings(object): return (self.notation == other.notation and self.units == other.units and self.zero_suppression == other.zero_suppression and - self.format == other.format) + self.format == other.format and + self.angle_units == other.angle_units) class CamFile(object): |