summaryrefslogtreecommitdiff
path: root/gerber/rs274x.py
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2016-06-25 16:46:44 +0800
committerGarret Fick <garret@ficksworkshop.com>2016-06-25 16:46:44 +0800
commitccb6eb7a766bd6edf314978f3ec4fc0dcd61652d (patch)
tree0f752f20823644f1950ab6bd4c85e66700498602 /gerber/rs274x.py
parentefcb221fc7bd8dae583357e6c4e1c2d3fc9e9df6 (diff)
downloadgerbonara-ccb6eb7a766bd6edf314978f3ec4fc0dcd61652d.tar.gz
gerbonara-ccb6eb7a766bd6edf314978f3ec4fc0dcd61652d.tar.bz2
gerbonara-ccb6eb7a766bd6edf314978f3ec4fc0dcd61652d.zip
Add support for polygon apertures
Diffstat (limited to 'gerber/rs274x.py')
-rw-r--r--gerber/rs274x.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/gerber/rs274x.py b/gerber/rs274x.py
index 7eba1c2..ffac66d 100644
--- a/gerber/rs274x.py
+++ b/gerber/rs274x.py
@@ -483,8 +483,18 @@ class GerberParser(object):
height = modifiers[0][1]
aperture = Obround(position=None, width=width, height=height, units=self.settings.units)
elif shape == 'P':
- # FIXME: not supported yet?
- pass
+ outer_diameter = modifiers[0][0]
+ number_vertices = int(modifiers[0][1])
+ if len(modifiers[0]) > 2:
+ rotation = modifiers[0][2]
+ else:
+ rotation = 0
+
+ if len(modifiers[0]) > 3:
+ hole_diameter = modifiers[0][3]
+ else:
+ hole_diameter = 0
+ aperture = Polygon(position=None, sides=number_vertices, radius=outer_diameter/2.0, hole_radius=hole_diameter/2.0, rotation=rotation)
else:
aperture = self.macros[shape].build(modifiers)