summaryrefslogtreecommitdiff
path: root/gerber/render/excellon_backend.py
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2016-03-05 14:56:08 +0800
committerGarret Fick <garret@ficksworkshop.com>2016-03-05 14:56:08 +0800
commit0f1d1c3a29017ea82e1f0f7795798405ef346706 (patch)
tree605a4c07276e5d63dd249cf2feec0fe83f560a2f /gerber/render/excellon_backend.py
parent5cb60d6385f167e814df7a608321a4f33da0e193 (diff)
downloadgerbonara-0f1d1c3a29017ea82e1f0f7795798405ef346706.tar.gz
gerbonara-0f1d1c3a29017ea82e1f0f7795798405ef346706.tar.bz2
gerbonara-0f1d1c3a29017ea82e1f0f7795798405ef346706.zip
Remove some testing code from gerber writer. More implementation for excellon writer - not working yet
Diffstat (limited to 'gerber/render/excellon_backend.py')
-rw-r--r--gerber/render/excellon_backend.py76
1 files changed, 76 insertions, 0 deletions
diff --git a/gerber/render/excellon_backend.py b/gerber/render/excellon_backend.py
new file mode 100644
index 0000000..bec8367
--- /dev/null
+++ b/gerber/render/excellon_backend.py
@@ -0,0 +1,76 @@
+
+from .render import GerberContext
+from ..excellon_statements import *
+
+class ExcellonContext(GerberContext):
+
+ def __init__(self, settings):
+ GerberContext.__init__(self)
+ self.comments = []
+ self.header = []
+ self.tool_def = []
+ self.body = []
+ self.end = [EndOfProgramStmt()]
+
+ self.handled_tools = set()
+ self.cur_tool = None
+ self.pos = (None, None)
+
+ self.settings = settings
+
+ self._start_header(settings)
+
+ def _start_header(self, settings):
+ pass
+
+ @property
+ def statements(self):
+ return self.comments + self.header + self.body + self.end
+
+ def set_bounds(self, bounds):
+ pass
+
+ def _paint_background(self):
+ pass
+
+ def _render_line(self, line, color):
+ raise ValueError('Invalid Excellon object')
+ def _render_arc(self, arc, color):
+ raise ValueError('Invalid Excellon object')
+
+ def _render_region(self, region, color):
+ raise ValueError('Invalid Excellon object')
+
+ def _render_level_polarity(self, region):
+ raise ValueError('Invalid Excellon object')
+
+ def _render_circle(self, circle, color):
+ raise ValueError('Invalid Excellon object')
+
+ def _render_rectangle(self, rectangle, color):
+ raise ValueError('Invalid Excellon object')
+
+ def _render_obround(self, obround, color):
+ raise ValueError('Invalid Excellon object')
+
+ def _render_polygon(self, polygon, color):
+ raise ValueError('Invalid Excellon object')
+
+ def _simplify_point(self, point):
+ return (point[0] if point[0] != self._pos[0] else None, point[1] if point[1] != self._pos[1] else None)
+
+ def _render_drill(self, drill, color):
+
+ if not drill in self.handled_tools:
+ self.tool_def.append(drill.tool)
+
+ if drill.tool != self.cur_tool:
+ self.body.append(ToolSelectionStmt(drill.tool.number))
+
+ point = self._simplify_point(drill.position)
+ self._pos = drill.position
+ self.body.append(CoordinateStmt.from_point())
+
+ def _render_inverted_layer(self):
+ pass
+ \ No newline at end of file