summaryrefslogtreecommitdiff
path: root/gerber/rs274x.py
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2016-07-24 17:08:47 +0800
committerGarret Fick <garret@ficksworkshop.com>2016-07-24 17:08:47 +0800
commit7cd6acf12670f3773113f67ed2acb35cb21c32a0 (patch)
treece2d79376375b8c7b4ee8c0f519f23d3f3fc1db9 /gerber/rs274x.py
parentcd4614f9973eb9f4ce858b3864573367614f54b6 (diff)
downloadgerbonara-7cd6acf12670f3773113f67ed2acb35cb21c32a0.tar.gz
gerbonara-7cd6acf12670f3773113f67ed2acb35cb21c32a0.tar.bz2
gerbonara-7cd6acf12670f3773113f67ed2acb35cb21c32a0.zip
Add many render tests based on the Umaco gerger specification. Fix multiple rendering bugs, especially related to holes in flashed apertures
Diffstat (limited to 'gerber/rs274x.py')
-rw-r--r--gerber/rs274x.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/gerber/rs274x.py b/gerber/rs274x.py
index 260fbf8..e88bba7 100644
--- a/gerber/rs274x.py
+++ b/gerber/rs274x.py
@@ -482,15 +482,33 @@ class GerberParser(object):
aperture = None
if shape == 'C':
diameter = modifiers[0][0]
- aperture = Circle(position=None, diameter=diameter, units=self.settings.units)
+
+ if len(modifiers[0]) >= 2:
+ hole_diameter = modifiers[0][1]
+ else:
+ hole_diameter = 0
+
+ aperture = Circle(position=None, diameter=diameter, hole_diameter=hole_diameter, units=self.settings.units)
elif shape == 'R':
width = modifiers[0][0]
height = modifiers[0][1]
- aperture = Rectangle(position=None, width=width, height=height, units=self.settings.units)
+
+ if len(modifiers[0]) >= 3:
+ hole_diameter = modifiers[0][2]
+ else:
+ hole_diameter = 0
+
+ aperture = Rectangle(position=None, width=width, height=height, hole_diameter=hole_diameter, units=self.settings.units)
elif shape == 'O':
width = modifiers[0][0]
height = modifiers[0][1]
- aperture = Obround(position=None, width=width, height=height, units=self.settings.units)
+
+ if len(modifiers[0]) >= 3:
+ hole_diameter = modifiers[0][2]
+ else:
+ hole_diameter = 0
+
+ aperture = Obround(position=None, width=width, height=height, hole_diameter=hole_diameter, units=self.settings.units)
elif shape == 'P':
outer_diameter = modifiers[0][0]
number_vertices = int(modifiers[0][1])