summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2016-06-30 22:46:20 +0800
committerGarret Fick <garret@ficksworkshop.com>2016-06-30 22:46:20 +0800
commitefb3703df4a9205a9476b682cd1e09e241ab8459 (patch)
tree92b29e75b9907bfbd1144b426863086370fe19f5
parentb140f5e4767912110f69cbda8417a8e076345b70 (diff)
downloadgerbonara-efb3703df4a9205a9476b682cd1e09e241ab8459.tar.gz
gerbonara-efb3703df4a9205a9476b682cd1e09e241ab8459.tar.bz2
gerbonara-efb3703df4a9205a9476b682cd1e09e241ab8459.zip
Fix rotation of center line
-rw-r--r--gerber/am_statements.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/gerber/am_statements.py b/gerber/am_statements.py
index a58f1dd..6ece68e 100644
--- a/gerber/am_statements.py
+++ b/gerber/am_statements.py
@@ -897,7 +897,28 @@ class AMCenterLinePrimitive(AMPrimitive):
return fmt.format(**data)
def to_primitive(self, units):
- return Rectangle(self.center, self.width, self.height, rotation=math.radians(self.rotation), units=units, level_polarity=self._level_polarity)
+
+ x = self.center[0]
+ y = self.center[1]
+ half_width = self.width / 2.0
+ half_height = self.height / 2.0
+
+ points = []
+ points.append((x - half_width, y + half_height))
+ points.append((x - half_width, y - half_height))
+ points.append((x + half_width, y - half_height))
+ points.append((x + half_width, y + half_height))
+
+ aperture = Circle((0, 0), 0)
+
+ lines = []
+ prev_point = rotate_point(points[3], self.rotation, self.center)
+ for point in points:
+ cur_point = rotate_point(point, self.rotation, self.center)
+
+ lines.append(Line(prev_point, cur_point, aperture))
+
+ return Outline(lines, units=units, level_polarity=self._level_polarity)
class AMLowerLeftLinePrimitive(AMPrimitive):