diff options
author | Garret Fick <garret@ficksworkshop.com> | 2016-05-28 13:06:08 +0800 |
---|---|---|
committer | Garret Fick <garret@ficksworkshop.com> | 2016-05-28 13:06:08 +0800 |
commit | 3fc296918e7d0d343840c5daa08eb6d564660a29 (patch) | |
tree | 64847e0483cc5bc4893c7fa426047200a4697a9f /gerber/render/rs274x_backend.py | |
parent | 49dadd46ee62a863b75087e9ed8f0590183bd525 (diff) | |
download | gerbonara-3fc296918e7d0d343840c5daa08eb6d564660a29.tar.gz gerbonara-3fc296918e7d0d343840c5daa08eb6d564660a29.tar.bz2 gerbonara-3fc296918e7d0d343840c5daa08eb6d564660a29.zip |
Use the known macro statement to render. Fix thermal not setting rotation
Diffstat (limited to 'gerber/render/rs274x_backend.py')
-rw-r--r-- | gerber/render/rs274x_backend.py | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/gerber/render/rs274x_backend.py b/gerber/render/rs274x_backend.py index 43695c3..2ca7014 100644 --- a/gerber/render/rs274x_backend.py +++ b/gerber/render/rs274x_backend.py @@ -13,28 +13,38 @@ 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 simpler - nooffset_group = deepcopy(amgroup) - nooffset_group.position = (0, 0) - - # Now draw the shapes - for primitive in nooffset_group.primitives: - if isinstance(primitive, Outline): - self._render_outline(primitive) - elif isinstance(primitive, Circle): - self._render_circle(primitive) - elif isinstance(primitive, Rectangle): - self._render_rectangle(primitive) - elif isinstance(primitive, Line): - self._render_line(primitive) - elif isinstance(primitive, Polygon): - self._render_polygon(primitive) - else: - raise ValueError('amgroup') - - statement = AMParamStmt('AM', name, self._statements_to_string()) - return statement + if amgroup.stmt: + # We know the statement it was generated from, so use that to create the AMParamStmt + # It will give a much better result + + stmt = deepcopy(amgroup.stmt) + stmt.name = name + + return stmt + + else: + # Clone ourselves, then offset by the psotion so that + # our render doesn't have to consider offset. Just makes things simpler + nooffset_group = deepcopy(amgroup) + nooffset_group.position = (0, 0) + + # Now draw the shapes + for primitive in nooffset_group.primitives: + if isinstance(primitive, Outline): + self._render_outline(primitive) + elif isinstance(primitive, Circle): + self._render_circle(primitive) + elif isinstance(primitive, Rectangle): + self._render_rectangle(primitive) + elif isinstance(primitive, Line): + self._render_line(primitive) + elif isinstance(primitive, Polygon): + self._render_polygon(primitive) + else: + raise ValueError('amgroup') + + statement = AMParamStmt('AM', name, self._statements_to_string()) + return statement def _statements_to_string(self): macro = '' |