summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2016-05-28 13:06:08 +0800
committerGarret Fick <garret@ficksworkshop.com>2016-05-28 13:06:08 +0800
commit3fc296918e7d0d343840c5daa08eb6d564660a29 (patch)
tree64847e0483cc5bc4893c7fa426047200a4697a9f
parent49dadd46ee62a863b75087e9ed8f0590183bd525 (diff)
downloadgerbonara-3fc296918e7d0d343840c5daa08eb6d564660a29.tar.gz
gerbonara-3fc296918e7d0d343840c5daa08eb6d564660a29.tar.bz2
gerbonara-3fc296918e7d0d343840c5daa08eb6d564660a29.zip
Use the known macro statement to render. Fix thermal not setting rotation
-rw-r--r--gerber/am_statements.py3
-rw-r--r--gerber/render/rs274x_backend.py54
2 files changed, 34 insertions, 23 deletions
diff --git a/gerber/am_statements.py b/gerber/am_statements.py
index faaed05..c3229ba 100644
--- a/gerber/am_statements.py
+++ b/gerber/am_statements.py
@@ -715,8 +715,9 @@ class AMThermalPrimitive(AMPrimitive):
outer_diameter = self.outer_diameter,
inner_diameter = self.inner_diameter,
gap = self.gap,
+ rotation = self.rotation
)
- fmt = "{code},{position},{outer_diameter},{inner_diameter},{gap}*"
+ fmt = "{code},{position},{outer_diameter},{inner_diameter},{gap},{rotation}*"
return fmt.format(**data)
def _approximate_arc_cw(self, start_angle, end_angle, radius, center):
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 = ''