summaryrefslogtreecommitdiff
path: root/gerber/rs274x.py
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2015-04-24 10:54:13 -0400
committerHamilton Kibbe <hamilton.kibbe@gmail.com>2015-04-24 10:54:13 -0400
commit390838fc8b70c9b105fdc1d3e35a4533b27faa83 (patch)
treec07ae5b56ccb13bce694ce1b51b4eab19ace0622 /gerber/rs274x.py
parenta3cce62be741cb2bc1e65165ba4f0b45c8838b60 (diff)
downloadgerbonara-390838fc8b70c9b105fdc1d3e35a4533b27faa83.tar.gz
gerbonara-390838fc8b70c9b105fdc1d3e35a4533b27faa83.tar.bz2
gerbonara-390838fc8b70c9b105fdc1d3e35a4533b27faa83.zip
Fix for #25. Checking was happening at the gerber/excellon file level, but I added units checking at the primitive level so the use case shown in the example is covered. Might want to throw a bunch more assertions in the test code (i started doing a few) to cover multiple calls to unit conversion functions
Diffstat (limited to 'gerber/rs274x.py')
-rw-r--r--gerber/rs274x.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/gerber/rs274x.py b/gerber/rs274x.py
index 606d27f..3dcddb4 100644
--- a/gerber/rs274x.py
+++ b/gerber/rs274x.py
@@ -469,12 +469,12 @@ class GerberParser(object):
end = (x, y)
if self.interpolation == 'linear':
- self.primitives.append(Line(start, end, self.apertures[self.aperture], level_polarity=self.level_polarity))
+ self.primitives.append(Line(start, end, self.apertures[self.aperture], level_polarity=self.level_polarity, units=self.settings.units))
else:
i = 0 if stmt.i is None else stmt.i
j = 0 if stmt.j is None else stmt.j
center = (start[0] + i, start[1] + j)
- self.primitives.append(Arc(start, end, center, self.direction, self.apertures[self.aperture], level_polarity=self.level_polarity))
+ self.primitives.append(Arc(start, end, center, self.direction, self.apertures[self.aperture], level_polarity=self.level_polarity, units=self.settings.units))
elif self.op == "D02":
pass
@@ -489,6 +489,7 @@ class GerberParser(object):
else:
primitive.position = (x, y)
primitive.level_polarity = self.level_polarity
+ primitive.units = self.settings.units
self.primitives.append(primitive)
self.x, self.y = x, y