Don't flash G03-only commands
This commit is contained in:
parent
ccb6eb7a76
commit
b140f5e476
3 changed files with 18 additions and 2 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue