summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2016-06-30 23:08:51 +0800
committerGarret Fick <garret@ficksworkshop.com>2016-06-30 23:08:51 +0800
commit14747494b89178372c65aad1e6ef8fa431e7f24c (patch)
tree70a40ec7df5f729e0d0faee5c3f3394244a83b9c
parentefb3703df4a9205a9476b682cd1e09e241ab8459 (diff)
downloadgerbonara-14747494b89178372c65aad1e6ef8fa431e7f24c.tar.gz
gerbonara-14747494b89178372c65aad1e6ef8fa431e7f24c.tar.bz2
gerbonara-14747494b89178372c65aad1e6ef8fa431e7f24c.zip
Rotate vector line
-rw-r--r--gerber/am_statements.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/gerber/am_statements.py b/gerber/am_statements.py
index 6ece68e..6cb90dc 100644
--- a/gerber/am_statements.py
+++ b/gerber/am_statements.py
@@ -308,7 +308,20 @@ class AMVectorLinePrimitive(AMPrimitive):
return fmtstr.format(**data)
def to_primitive(self, units):
- return Line(self.start, self.end, Rectangle(None, self.width, self.width), units=units, level_polarity=self._level_polarity)
+
+ line = Line(self.start, self.end, Rectangle(None, self.width, self.width))
+ vertices = line.vertices
+
+ aperture = Circle((0, 0), 0)
+
+ lines = []
+ prev_point = rotate_point(vertices[-1], self.rotation, (0, 0))
+ for point in vertices:
+ cur_point = rotate_point(point, self.rotation, (0, 0))
+
+ lines.append(Line(prev_point, cur_point, aperture))
+
+ return Outline(lines, units=units, level_polarity=self._level_polarity)
class AMOutlinePrimitive(AMPrimitive):