diff options
author | Garret Fick <garret@ficksworkshop.com> | 2015-12-16 18:59:25 +0800 |
---|---|---|
committer | Garret Fick <garret@ficksworkshop.com> | 2015-12-16 18:59:25 +0800 |
commit | 206f4c57ab66f8a6753015340315991b40178c9b (patch) | |
tree | 0b1a199270dac696193c8eaead7987f59c5f73b4 /gerber/primitives.py | |
parent | 221f67d8fe77ecae6c8e99db767eace5da0c1f9e (diff) | |
download | gerbonara-206f4c57ab66f8a6753015340315991b40178c9b.tar.gz gerbonara-206f4c57ab66f8a6753015340315991b40178c9b.tar.bz2 gerbonara-206f4c57ab66f8a6753015340315991b40178c9b.zip |
Fix drawing arcs. Dont crash for arcs with rectangular apertures. Fix crash with board size of zero for only one drill
Diffstat (limited to 'gerber/primitives.py')
-rw-r--r-- | gerber/primitives.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/gerber/primitives.py b/gerber/primitives.py index 1e26f19..3f68496 100644 --- a/gerber/primitives.py +++ b/gerber/primitives.py @@ -256,10 +256,19 @@ class Arc(Primitive): if theta1 <= math.pi * 1.5 and (theta0 >= math.pi * 1.5 or theta0 < theta1):
points.append((self.center[0], self.center[1] - self.radius ))
x, y = zip(*points)
- min_x = min(x) - self.aperture.radius
- max_x = max(x) + self.aperture.radius
- min_y = min(y) - self.aperture.radius
- max_y = max(y) + self.aperture.radius
+
+ if isinstance(self.aperture, Circle):
+ radius = self.aperture.radius
+ else:
+ # TODO this is actually not valid, but files contain it
+ width = self.aperture.width
+ height = self.aperture.height
+ radius = max(width, height)
+
+ min_x = min(x) - radius
+ max_x = max(x) + radius
+ min_y = min(y) - radius
+ max_y = max(y) + radius
return ((min_x, max_x), (min_y, max_y))
def offset(self, x_offset=0, y_offset=0):
|