Fix converting amgroup units

This commit is contained in:
Garret Fick 2016-05-28 14:14:49 +08:00
parent 3fc296918e
commit 5a20b2b92d
2 changed files with 21 additions and 2 deletions

View file

@ -795,9 +795,26 @@ class AMGroup(Primitive):
elif prim:
self.primitives.append(prim)
self._position = None
self._to_convert = ['primitives']
self._to_convert = ['_position', 'primitives']
self.stmt = stmt
def to_inch(self):
if self.units == 'metric':
super(AMGroup, self).to_inch()
# If we also have a stmt, convert that too
if self.stmt:
self.stmt.to_inch()
def to_metric(self):
if self.units == 'inch':
super(AMGroup, self).to_metric()
# If we also have a stmt, convert that too
if self.stmt:
self.stmt.to_metric()
@property
def flashed(self):
return True

View file

@ -373,7 +373,9 @@ class GerberParser(object):
elif param["param"] == "AD":
yield ADParamStmt.from_dict(param)
elif param["param"] == "AM":
yield AMParamStmt.from_dict(param)
stmt = AMParamStmt.from_dict(param)
stmt.units = self.settings.units
yield stmt
elif param["param"] == "OF":
yield OFParamStmt.from_dict(param)
elif param["param"] == "IN":