summaryrefslogtreecommitdiff
path: root/gerber/render/render.py
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2016-07-10 15:07:17 +0800
committerGarret Fick <garret@ficksworkshop.com>2016-07-10 15:07:17 +0800
commit9b0d3b1122ffc3b7c2211b0cdc2cb6de6be9b242 (patch)
tree943e11c4167fecec83fbe68ca7df9de294b5989b /gerber/render/render.py
parent0107d159b5a04c282478ceb4c51fdd03af3bd8c9 (diff)
downloadgerbonara-9b0d3b1122ffc3b7c2211b0cdc2cb6de6be9b242.tar.gz
gerbonara-9b0d3b1122ffc3b7c2211b0cdc2cb6de6be9b242.tar.bz2
gerbonara-9b0d3b1122ffc3b7c2211b0cdc2cb6de6be9b242.zip
Fix issue with chaning region mode via flash. Add options for controlling output from rendered gerber
Diffstat (limited to 'gerber/render/render.py')
-rw-r--r--gerber/render/render.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/gerber/render/render.py b/gerber/render/render.py
index 41b632c..128496f 100644
--- a/gerber/render/render.py
+++ b/gerber/render/render.py
@@ -136,6 +136,9 @@ class GerberContext(object):
return
color = (self.color if primitive.level_polarity == 'dark'
else self.background_color)
+
+ self._pre_render_primitive(primitive)
+
if isinstance(primitive, Line):
self._render_line(primitive, color)
elif isinstance(primitive, Arc):
@@ -160,8 +163,22 @@ class GerberContext(object):
self._render_region(primitive, color)
elif isinstance(primitive, TestRecord):
self._render_test_record(primitive, color)
- else:
- return
+
+ self._post_render_primitive(primitive)
+
+ def _pre_render_primitive(self, primitive):
+ """
+ Called before rendering a primitive. Use the callback to perform some action before rendering
+ a primitive, for example adding a comment.
+ """
+ return
+
+ def _post_render_primitive(self, primitive):
+ """
+ Called after rendering a primitive. Use the callback to perform some action after rendering
+ a primitive
+ """
+ return
def _render_line(self, primitive, color):
pass