From d83ad016689375aba9f3abcfa3632cd8df8e9083 Mon Sep 17 00:00:00 2001 From: Eero af Heurlin Date: Thu, 26 Aug 2010 10:08:44 +0300 Subject: [PATCH] just found out that there are 2D primitives too, no need to use DXF... so changed the triangle to use polygon and extrusion, cleaner than doing weird booleans. This changes the default orientation of the triangle so adapted the servo library too. --- servos.scad | 12 ++++++------ triangles.scad | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/servos.scad b/servos.scad index 22e8ca8..a635a97 100644 --- a/servos.scad +++ b/servos.scad @@ -7,7 +7,7 @@ * License: LGPL 2.1 */ -use +use /** * Align DS420 digital servo @@ -57,9 +57,9 @@ module alignds420(position, rotation, screws = 0, axle_lenght = 0) } // The large slope - translate([6,18,19.0]) + translate([-6,0,19]) { - rotate([0,0,180]) + rotate([90,0,90]) { triangle(4, 18, 12); } @@ -80,11 +80,11 @@ module alignds420(position, rotation, screws = 0, axle_lenght = 0) { cube([12,6.5,4]); } - translate([-7,1,24.0]) + translate([7,-7,24.0]) { - rotate([180,0,0]) + rotate([-90,0,90]) { - triangle(3, 8, 14); + triangle(3, 8, 14); } } diff --git a/triangles.scad b/triangles.scad index 0735cc3..76a4822 100644 --- a/triangles.scad +++ b/triangles.scad @@ -15,6 +15,7 @@ * @param number a_len Lenght of the adjacent side * @param number depth How wide/deep the triangle is in the 3rd dimension */ +/* module triangle(o_len, a_len, depth) { difference() @@ -29,3 +30,26 @@ module triangle(o_len, a_len, depth) } } } + +# triangle(5,10,7); +*/ + + +/** + * Standard right-angled triangle + * + * @param number o_len Lenght of the opposite side + * @param number a_len Lenght of the adjacent side + * @param number depth How wide/deep the triangle is in the 3rd dimension + * @todo a better way ? + */ +module triangle(o_len, a_len, depth) +{ + linear_extrude(height=depth) + { + polygon(points=[[0,0],[a_len,0],[0,o_len]], paths=[[0,1,2]]); + } +} + +triangle(5,10,7); +