summaryrefslogtreecommitdiff
path: root/gerber/am_statements.py
diff options
context:
space:
mode:
authorGarret Fick <garret@ficksworkshop.com>2015-12-30 15:32:44 +0800
committerGarret Fick <garret@ficksworkshop.com>2015-12-30 15:32:44 +0800
commit96692b22216fdfe11f2ded104ac0bdba3b7866a5 (patch)
treee5b67a826e1df88eab008136d1db08d859854063 /gerber/am_statements.py
parent4a815bf25ddd1d378ec6ad5af008e5bbcd362b51 (diff)
downloadgerbonara-96692b22216fdfe11f2ded104ac0bdba3b7866a5.tar.gz
gerbonara-96692b22216fdfe11f2ded104ac0bdba3b7866a5.tar.bz2
gerbonara-96692b22216fdfe11f2ded104ac0bdba3b7866a5.zip
Render primitives for some aperture macros
Diffstat (limited to 'gerber/am_statements.py')
-rw-r--r--gerber/am_statements.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/gerber/am_statements.py b/gerber/am_statements.py
index 0e4f5f4..599d19d 100644
--- a/gerber/am_statements.py
+++ b/gerber/am_statements.py
@@ -16,9 +16,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from math import pi
-from .utils import validate_coordinates, inch, metric
-from .primitives import Circle, Line, Rectangle
+import math
+from .utils import validate_coordinates, inch, metric, rotate_point
+from .primitives import Circle, Line, Outline, Rectangle
# TODO: Add support for aperture macro variables
@@ -382,7 +382,15 @@ class AMOutlinePrimitive(AMPrimitive):
return "{code},{exposure},{n_points},{start_point},{points},{rotation}*".format(**data)
def to_primitive(self, units):
- raise NotImplementedError()
+
+ lines = []
+ prev_point = rotate_point(self.points[0], self.rotation)
+ for point in self.points[1:]:
+ cur_point = rotate_point(self.points[0], self.rotation)
+
+ lines.append(Line(prev_point, cur_point, Circle((0,0), 0)))
+
+ return Outline(lines, units=units)
class AMPolygonPrimitive(AMPrimitive):
@@ -762,7 +770,7 @@ class AMCenterLinePrimitive(AMPrimitive):
return fmt.format(**data)
def to_primitive(self, units):
- return Rectangle(self.center, self.width, self.height, rotation=self.rotation * pi / 180.0, units=units)
+ return Rectangle(self.center, self.width, self.height, rotation=math.radians(self.rotation), units=units)
class AMLowerLeftLinePrimitive(AMPrimitive):