diff options
author | Garret Fick <garret@ficksworkshop.com> | 2016-03-26 15:59:42 +0800 |
---|---|---|
committer | Garret Fick <garret@ficksworkshop.com> | 2016-03-26 15:59:42 +0800 |
commit | acde19f205898188c03a46e5d8a7a6a4d4637a2d (patch) | |
tree | f1c11657ecf104fa86d33c233d2c67dd7d40cd96 /gerber/primitives.py | |
parent | d12f6385a434c02677bfbb7b075dd9d8e49627fe (diff) | |
download | gerbonara-acde19f205898188c03a46e5d8a7a6a4d4637a2d.tar.gz gerbonara-acde19f205898188c03a46e5d8a7a6a4d4637a2d.tar.bz2 gerbonara-acde19f205898188c03a46e5d8a7a6a4d4637a2d.zip |
Support for the G85 slot statement
Diffstat (limited to 'gerber/primitives.py')
-rw-r--r-- | gerber/primitives.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gerber/primitives.py b/gerber/primitives.py index e5ff35f..3ecf0db 100644 --- a/gerber/primitives.py +++ b/gerber/primitives.py @@ -1109,6 +1109,42 @@ class Drill(Primitive): def offset(self, x_offset=0, y_offset=0):
self.position = tuple(map(add, self.position, (x_offset, y_offset)))
+
+
+class Slot(Primitive):
+ """ A drilled slot
+ """
+ def __init__(self, start, end, diameter, hit, **kwargs):
+ super(Slot, self).__init__('dark', **kwargs)
+ validate_coordinates(start)
+ validate_coordinates(end)
+ self.start = start
+ self.end = end
+ self.diameter = diameter
+ self.hit = hit
+ self._to_convert = ['start', 'end', 'diameter']
+
+ @property
+ def flashed(self):
+ return False
+
+ @property
+ def radius(self):
+ return self.diameter / 2.
+
+ @property
+ def bounding_box(self):
+ radius = self.radius
+ min_x = min(self.start[0], self.end[0]) - radius
+ max_x = max(self.start[0], self.end[0]) + radius
+ min_y = min(self.start[1], self.end[1]) - radius
+ max_y = max(self.start[1], self.end[1]) + radius
+ return ((min_x, max_x), (min_y, max_y))
+
+ def offset(self, x_offset=0, y_offset=0):
+ self.start = tuple(map(add, self.start, (x_offset, y_offset)))
+ self.end = tuple(map(add, self.end, (x_offset, y_offset)))
+
class TestRecord(Primitive):
""" Netlist Test record
|