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.
This commit is contained in:
Eero af Heurlin 2010-08-26 15:08:44 +08:00 committed by Elmo
parent f74a94b519
commit fd3da7a8c1
2 changed files with 30 additions and 6 deletions

View file

@ -7,7 +7,7 @@
* License: LGPL 2.1 * License: LGPL 2.1
*/ */
use <triangle.scad> use <triangles.scad>
/** /**
* Align DS420 digital servo * Align DS420 digital servo
@ -57,9 +57,9 @@ module alignds420(position, rotation, screws = 0, axle_lenght = 0)
} }
// The large slope // The large slope
translate([6,18,19.0]) translate([-6,0,19])
{ {
rotate([0,0,180]) rotate([90,0,90])
{ {
triangle(4, 18, 12); triangle(4, 18, 12);
} }
@ -80,9 +80,9 @@ module alignds420(position, rotation, screws = 0, axle_lenght = 0)
{ {
cube([12,6.5,4]); 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);
} }

View file

@ -15,6 +15,7 @@
* @param number a_len Lenght of the adjacent side * @param number a_len Lenght of the adjacent side
* @param number depth How wide/deep the triangle is in the 3rd dimension * @param number depth How wide/deep the triangle is in the 3rd dimension
*/ */
/*
module triangle(o_len, a_len, depth) module triangle(o_len, a_len, depth)
{ {
difference() 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);