summaryrefslogtreecommitdiff
path: root/gerber/rs274x.py
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2015-09-10 15:54:29 -0400
committerHamilton Kibbe <hamilton.kibbe@gmail.com>2015-09-10 15:54:29 -0400
commitb81c9d4bf96845ced3495eb158ec3a3c9e4dce3d (patch)
treeab939229a9735a4c0fd831daf0a11151d3c78d0a /gerber/rs274x.py
parentc92d2d9ea2853fd22b5ff51f211b03b4e660c551 (diff)
parentcb2fa34e881a389cf8a4bc98fd12be662ff687f8 (diff)
downloadgerbonara-b81c9d4bf96845ced3495eb158ec3a3c9e4dce3d.tar.gz
gerbonara-b81c9d4bf96845ced3495eb158ec3a3c9e4dce3d.tar.bz2
gerbonara-b81c9d4bf96845ced3495eb158ec3a3c9e4dce3d.zip
Merge pull request #40 from curtacircuitos/cairo-render-unification
Cairo render unification
Diffstat (limited to 'gerber/rs274x.py')
-rw-r--r--gerber/rs274x.py31
1 files changed, 19 insertions, 12 deletions
diff --git a/gerber/rs274x.py b/gerber/rs274x.py
index b4963d1..1df3646 100644
--- a/gerber/rs274x.py
+++ b/gerber/rs274x.py
@@ -468,22 +468,29 @@ class GerberParser(object):
stmt.op = self.op
if self.op == "D01":
- if self.region_mode == 'on':
- if self.current_region is None:
- self.current_region = [(self.x, self.y), ]
- self.current_region.append((x, y,))
- else:
- start = (self.x, self.y)
- end = (x, y)
+ start = (self.x, self.y)
+ end = (x, y)
- if self.interpolation == 'linear':
+ if self.interpolation == 'linear':
+ if self.region_mode == 'off':
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)
+ if self.current_region is None:
+ self.current_region = [Line(start, end, self.apertures[self.aperture], level_polarity=self.level_polarity, units=self.settings.units),]
+ else:
+ self.current_region.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)
+ if self.region_mode == 'off':
self.primitives.append(Arc(start, end, center, self.direction, self.apertures[self.aperture], level_polarity=self.level_polarity, units=self.settings.units))
-
+ else:
+ if self.current_region is None:
+ self.current_region = [Arc(start, end, center, self.direction, self.apertures[self.aperture], level_polarity=self.level_polarity, units=self.settings.units),]
+ else:
+ self.current_region.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