diff options
author | Garret Fick <garret@ficksworkshop.com> | 2016-05-28 12:36:31 +0800 |
---|---|---|
committer | Garret Fick <garret@ficksworkshop.com> | 2016-05-28 12:36:31 +0800 |
commit | c9c1313d598d5afa8cb387a2cfcd4a4281086e01 (patch) | |
tree | dd8898023c6cae3e282df5fb6f7ed50a85f3d5cf /gerber | |
parent | d1d112f2f152784ead18bfa25c70caf210020666 (diff) | |
download | gerbonara-c9c1313d598d5afa8cb387a2cfcd4a4281086e01.tar.gz gerbonara-c9c1313d598d5afa8cb387a2cfcd4a4281086e01.tar.bz2 gerbonara-c9c1313d598d5afa8cb387a2cfcd4a4281086e01.zip |
Fix units statement. Keep track of original macro statement in the AMGroup
Diffstat (limited to 'gerber')
-rw-r--r-- | gerber/gerber_statements.py | 4 | ||||
-rw-r--r-- | gerber/primitives.py | 11 | ||||
-rw-r--r-- | gerber/render/rs274x_backend.py | 2 |
3 files changed, 11 insertions, 6 deletions
diff --git a/gerber/gerber_statements.py b/gerber/gerber_statements.py index 119df9d..b171a7f 100644 --- a/gerber/gerber_statements.py +++ b/gerber/gerber_statements.py @@ -176,7 +176,7 @@ class MOParamStmt(ParamStmt): @classmethod def from_units(cls, units): - return cls(None, 'inch') + return cls(None, units) @classmethod def from_dict(cls, stmt_dict): @@ -425,7 +425,7 @@ class AMParamStmt(ParamStmt): else: self.primitives.append(AMUnsupportPrimitive.from_gerber(primitive)) - return AMGroup(self.primitives, units=self.units) + return AMGroup(self.primitives, stmt=self, units=self.units) def to_inch(self): if self.units == 'metric': diff --git a/gerber/primitives.py b/gerber/primitives.py index 3ecf0db..d74226d 100644 --- a/gerber/primitives.py +++ b/gerber/primitives.py @@ -763,9 +763,9 @@ class Polygon(Primitive): return points
def equivalent(self, other, offset):
- '''
+ """
Is this the outline the same as the other, ignoring the position offset?
- '''
+ """
# Quick check if it even makes sense to compare them
if type(self) != type(other) or self.sides != other.sides or self.radius != other.radius:
@@ -779,7 +779,11 @@ class Polygon(Primitive): class AMGroup(Primitive):
"""
"""
- def __init__(self, amprimitives, **kwargs):
+ def __init__(self, amprimitives, stmt = None, **kwargs):
+ """
+
+ stmt : The original statment that generated this, since it is really hard to re-generate from primitives
+ """
super(AMGroup, self).__init__(**kwargs)
self.primitives = []
@@ -792,6 +796,7 @@ class AMGroup(Primitive): self.primitives.append(prim)
self._position = None
self._to_convert = ['primitives']
+ self.stmt = stmt
@property
def flashed(self):
diff --git a/gerber/render/rs274x_backend.py b/gerber/render/rs274x_backend.py index 3dc8c1a..43695c3 100644 --- a/gerber/render/rs274x_backend.py +++ b/gerber/render/rs274x_backend.py @@ -14,7 +14,7 @@ class AMGroupContext(object): def render(self, amgroup, name): # Clone ourselves, then offset by the psotion so that - # our render doesn't have to consider offset. Just makes things simplder + # our render doesn't have to consider offset. Just makes things simpler nooffset_group = deepcopy(amgroup) nooffset_group.position = (0, 0) |