summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2016-06-28 23:15:20 +0800
committerGarret Fick <garret@ficksworkshop.com>2016-06-28 23:15:20 +0800
commitb140f5e4767912110f69cbda8417a8e076345b70 (patch)
treebd9c74ddff137aec3e56e9179999ed4946902af3
parentccb6eb7a766bd6edf314978f3ec4fc0dcd61652d (diff)
downloadgerbonara-b140f5e4767912110f69cbda8417a8e076345b70.tar.gz
gerbonara-b140f5e4767912110f69cbda8417a8e076345b70.tar.bz2
gerbonara-b140f5e4767912110f69cbda8417a8e076345b70.zip
Don't flash G03-only commands
-rw-r--r--gerber/am_statements.py4
-rw-r--r--gerber/gerber_statements.py10
-rw-r--r--gerber/rs274x.py6
3 files changed, 18 insertions, 2 deletions
diff --git a/gerber/am_statements.py b/gerber/am_statements.py
index 0d92a8c..a58f1dd 100644
--- a/gerber/am_statements.py
+++ b/gerber/am_statements.py
@@ -523,7 +523,7 @@ class AMPolygonPrimitive(AMPrimitive):
return fmt.format(**data)
def to_primitive(self, units):
- return Polygon(self.position, self.vertices, self.diameter / 2.0, hole_radius=0, rotation=self.rotation, units=units, level_polarity=self._level_polarity)
+ return Polygon(self.position, self.vertices, self.diameter / 2.0, rotation=math.radians(self.rotation), units=units, level_polarity=self._level_polarity)
class AMMoirePrimitive(AMPrimitive):
@@ -897,7 +897,7 @@ class AMCenterLinePrimitive(AMPrimitive):
return fmt.format(**data)
def to_primitive(self, units):
- return Rectangle(self.center, self.width, self.height, rotation=self.rotation, units=units, level_polarity=self._level_polarity)
+ return Rectangle(self.center, self.width, self.height, rotation=math.radians(self.rotation), units=units, level_polarity=self._level_polarity)
class AMLowerLeftLinePrimitive(AMPrimitive):
diff --git a/gerber/gerber_statements.py b/gerber/gerber_statements.py
index 234952e..881e5bc 100644
--- a/gerber/gerber_statements.py
+++ b/gerber/gerber_statements.py
@@ -1022,6 +1022,16 @@ class CoordStmt(Statement):
coord_str += 'Op: %s' % op
return '<Coordinate Statement: %s>' % coord_str
+
+ @property
+ def only_function(self):
+ """
+ Returns if the statement only set the function.
+ """
+
+ # TODO I would like to refactor this so that the function is handled separately and then
+ # TODO this isn't required
+ return self.function != None and self.op == None and self.x == None and self.y == None and self.i == None and self.j == None
class ApertureStmt(Statement):
diff --git a/gerber/rs274x.py b/gerber/rs274x.py
index ffac66d..384d498 100644
--- a/gerber/rs274x.py
+++ b/gerber/rs274x.py
@@ -536,6 +536,12 @@ class GerberParser(object):
elif stmt.function in ('G02', 'G2', 'G03', 'G3'):
self.interpolation = 'arc'
self.direction = ('clockwise' if stmt.function in ('G02', 'G2') else 'counterclockwise')
+
+ if stmt.only_function:
+ # Sometimes we get a coordinate statement
+ # that only sets the function. If so, don't
+ # try futher otherwise that might draw/flash something
+ return
if stmt.op:
self.op = stmt.op