summaryrefslogtreecommitdiff
path: root/gerber/rs274x.py
diff options
context:
space:
mode:
authorPaulo Henrique Silva <ph.silva@gmail.com>2015-04-13 16:55:03 -0300
committerPaulo Henrique Silva <ph.silva@gmail.com>2015-04-13 16:55:03 -0300
commitd6bb61eec681d5151fb5869b6a8e4618eba1398d (patch)
tree5dfd1c28fc54eac59d553c1da6ff7d2560d3183e /gerber/rs274x.py
parentd7ce97b180d7652b6e55470b3fe755a689b03ba8 (diff)
downloadgerbonara-d6bb61eec681d5151fb5869b6a8e4618eba1398d.tar.gz
gerbonara-d6bb61eec681d5151fb5869b6a8e4618eba1398d.tar.bz2
gerbonara-d6bb61eec681d5151fb5869b6a8e4618eba1398d.zip
Fix issue where D01 and D03 are implicit.
Based on code from @rdprescott.
Diffstat (limited to 'gerber/rs274x.py')
-rw-r--r--gerber/rs274x.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/gerber/rs274x.py b/gerber/rs274x.py
index 9403517..6069c03 100644
--- a/gerber/rs274x.py
+++ b/gerber/rs274x.py
@@ -195,7 +195,7 @@ class GerberParser(object):
self.current_region = None
self.x = 0
self.y = 0
-
+ self.op = "D02"
self.aperture = 0
self.interpolation = 'linear'
self.direction = 'clockwise'
@@ -453,7 +453,10 @@ class GerberParser(object):
self.interpolation = 'arc'
self.direction = ('clockwise' if stmt.function in ('G02', 'G2') else 'counterclockwise')
- if stmt.op == "D01":
+ if stmt.op:
+ self.op = stmt.op
+
+ if self.op == "D01":
if self.region_mode == 'on':
if self.current_region is None:
self.current_region = [(self.x, self.y), ]
@@ -470,10 +473,10 @@ class GerberParser(object):
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))
- elif stmt.op == "D02":
+ elif self.op == "D02":
pass
- elif stmt.op == "D03":
+ elif self.op == "D03":
primitive = copy.deepcopy(self.apertures[self.aperture])
# XXX: temporary fix because there are no primitives for Macros and Polygon
if primitive is not None: