summaryrefslogtreecommitdiff
path: root/gerber/render/render.py
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2014-10-10 20:36:38 -0400
committerHamilton Kibbe <hamilton.kibbe@gmail.com>2014-10-10 20:36:38 -0400
commit76c03a55c91addff71339d80cf17560926f1580b (patch)
tree36e6e8b403eafd47cf3f02e9c9914d2cd6e65ea3 /gerber/render/render.py
parent1750c3c60aeffc813dad8191ceabcdb90dd2e0a6 (diff)
downloadgerbonara-76c03a55c91addff71339d80cf17560926f1580b.tar.gz
gerbonara-76c03a55c91addff71339d80cf17560926f1580b.tar.bz2
gerbonara-76c03a55c91addff71339d80cf17560926f1580b.zip
Working region fills and level polarity. Renders Altium-generated gerbers like a champ!
Diffstat (limited to 'gerber/render/render.py')
-rw-r--r--gerber/render/render.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/gerber/render/render.py b/gerber/render/render.py
index e76aed1..48a53f8 100644
--- a/gerber/render/render.py
+++ b/gerber/render/render.py
@@ -96,7 +96,7 @@ class GerberContext(object):
self.level_polarity = 'dark'
self.region_mode = 'off'
self.quadrant_mode = 'multi-quadrant'
-
+ self.step_and_repeat = (1, 1, 0, 0)
self.color = (0.7215, 0.451, 0.200)
self.drill_color = (0.25, 0.25, 0.25)
self.background_color = (0.0, 0.0, 0.0)
@@ -415,6 +415,12 @@ class GerberContext(object):
"""
pass
+ def region_contour(self, x, y):
+ pass
+
+ def fill_region(self):
+ pass
+
def evaluate(self, stmt):
""" Evaluate Gerber statement and update image accordingly.
@@ -450,7 +456,7 @@ class GerberContext(object):
def _evaluate_mode(self, stmt):
if stmt.type == 'RegionMode':
if self.region_mode == 'on' and stmt.mode == 'off':
- self._fill_region()
+ self.fill_region()
self.region_mode = stmt.mode
elif stmt.type == 'QuadrantMode':
self.quadrant_mode = stmt.mode
@@ -460,11 +466,11 @@ class GerberContext(object):
self.set_coord_format(stmt.zero_suppression, stmt.format,
stmt.notation)
self.set_coord_notation(stmt.notation)
- elif stmt.param == "MO:":
+ elif stmt.param == "MO":
self.set_coord_unit(stmt.mode)
- elif stmt.param == "IP:":
+ elif stmt.param == "IP":
self.set_image_polarity(stmt.ip)
- elif stmt.param == "LP:":
+ elif stmt.param == "LP":
self.set_level_polarity(stmt.lp)
elif stmt.param == "AD":
self.define_aperture(stmt.d, stmt.shape, stmt.modifiers)
@@ -477,7 +483,10 @@ class GerberContext(object):
self.direction = ('clockwise' if stmt.function in ('G02', 'G2')
else 'counterclockwise')
if stmt.op == "D01":
- self.stroke(stmt.x, stmt.y, stmt.i, stmt.j)
+ if self.region_mode == 'on':
+ self.region_contour(stmt.x, stmt.y)
+ else:
+ self.stroke(stmt.x, stmt.y, stmt.i, stmt.j)
elif stmt.op == "D02":
self.move(stmt.x, stmt.y)
elif stmt.op == "D03":
@@ -486,5 +495,3 @@ class GerberContext(object):
def _evaluate_aperture(self, stmt):
self.set_aperture(stmt.d)
- def _fill_region(self):
- pass