summaryrefslogtreecommitdiff
path: root/gerber
diff options
context:
space:
mode:
Diffstat (limited to 'gerber')
-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 = ''