From bd6f6e3dbb1cd471b19fd2a68611e66a4a291695 Mon Sep 17 00:00:00 2001 From: Eero af Heurlin Date: Wed, 25 Aug 2010 23:00:19 +0800 Subject: [PATCH 1/3] adding my parts to this library --- servos.scad | 108 +++++++++++++++++++++++++++++++++++++++++++++++++ triangles.scad | 31 ++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 servos.scad create mode 100644 triangles.scad diff --git a/servos.scad b/servos.scad new file mode 100644 index 0000000..585fdbb --- /dev/null +++ b/servos.scad @@ -0,0 +1,108 @@ +/** + * Servo outline library + * + * Authors: + * - Eero 'rambo' af Heurlin 2010- + * + * License: GPL 2.0 + */ + +use + +/** + * Align DS420 digital servo + * + * @param vector position The position vector + * @param vector rotation The rotation vector + * @param boolean screws If defined then "screws" will be added and when the module is differenced() from something if will have holes for the screws + * @param number axle_lenght If defined this will draw "backgound" indicator for the main axle + */ +module alignds420(position, rotation, screws = 0, axle_lenght = 0) +{ + translate(position) + { + rotate(rotation) + { + union() + { + // Main axle + translate([0,0,17]) + { + cylinder(r=6, h=8, $fn=30); + cylinder(r=2.5, h=10.5, $fn=20); + } + // Box and ears + translate([-6,-6,0]) + { + cube([12, 22.8,19.5], false); + translate([0,-5, 17]) + { + cube([12, 7, 2.5]); + } + translate([0, 20.8, 17]) + { + cube([12, 7, 2.5]); + } + } + if (screws > 0) + { + translate([0,(-10.2 + 1.8),11.5]) + { + # cylinder(r=1.8/2, h=6, $fn=6); + } + translate([0,(21.0 - 1.8),11.5]) + { + # cylinder(r=1.8/2, h=6, $fn=6); + } + + } + // The large slope + translate([6,18,19.0]) + { + rotate([0,0,180]) + { + triangle(4, 18, 12); + } + } + + /** + * This seems to get too complex fast + // Small additional axes + translate([0,6,17]) + { + cylinder(r=2.5, h=6, $fn=10); + cylinder(r=1.25, h=8, $fn=10); + } + // Small slope + difference() + { + translate([-6,-6,19.0]) + { + cube([12,6.5,4]); + } + translate([-7,1,24.0]) + { + rotate([180,0,0]) + { + triangle(3, 8, 14); + } + } + + } + */ + // So we render a cube instead of the small slope on a cube + translate([-6,-6,19.0]) + { + cube([12,6.5,4]); + } + } + if (axle_lenght > 0) + { + % cylinder(r=0.9, h=axle_lenght, center=true, $fn=8); + } + } + } +} + +// Example, uncomment to test +alignds420(screws=1); diff --git a/triangles.scad b/triangles.scad new file mode 100644 index 0000000..37157d8 --- /dev/null +++ b/triangles.scad @@ -0,0 +1,31 @@ +/** + * Simple triangles library + * + * Authors: + * - Eero 'rambo' af Heurlin 2010- + * + * License: GPL 2.0 + */ + + +/** + * 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 + */ +module triangle(o_len, a_len, depth) +{ + difference() + { + cube([depth, a_len, o_len], center=false); + rotate([atan(o_len/a_len),0,0]) + { + translate([-2.5,0,0]) + { + cube([depth+5,sqrt(pow(a_len, 2) + pow(o_len,2))+2, o_len+2], center=false); + } + } + } +} From f74a94b5192219cd8cc3ac566f2953073f7ef613 Mon Sep 17 00:00:00 2001 From: Elmom Date: Wed, 25 Aug 2010 19:35:45 +0300 Subject: [PATCH 2/3] Changed license information on behalf of the author --- servos.scad | 16 ++++++++-------- triangles.scad | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/servos.scad b/servos.scad index 585fdbb..22e8ca8 100644 --- a/servos.scad +++ b/servos.scad @@ -2,9 +2,9 @@ * Servo outline library * * Authors: - * - Eero 'rambo' af Heurlin 2010- + * - Eero 'rambo' af Heurlin 2010- * - * License: GPL 2.0 + * License: LGPL 2.1 */ use @@ -35,11 +35,11 @@ module alignds420(position, rotation, screws = 0, axle_lenght = 0) translate([-6,-6,0]) { cube([12, 22.8,19.5], false); - translate([0,-5, 17]) + translate([0,-5, 17]) { cube([12, 7, 2.5]); } - translate([0, 20.8, 17]) + translate([0, 20.8, 17]) { cube([12, 7, 2.5]); } @@ -54,7 +54,7 @@ module alignds420(position, rotation, screws = 0, axle_lenght = 0) { # cylinder(r=1.8/2, h=6, $fn=6); } - + } // The large slope translate([6,18,19.0]) @@ -65,7 +65,7 @@ module alignds420(position, rotation, screws = 0, axle_lenght = 0) } } - /** + /** * This seems to get too complex fast // Small additional axes translate([0,6,17]) @@ -87,7 +87,7 @@ module alignds420(position, rotation, screws = 0, axle_lenght = 0) triangle(3, 8, 14); } } - + } */ // So we render a cube instead of the small slope on a cube @@ -101,7 +101,7 @@ module alignds420(position, rotation, screws = 0, axle_lenght = 0) % cylinder(r=0.9, h=axle_lenght, center=true, $fn=8); } } - } + } } // Example, uncomment to test diff --git a/triangles.scad b/triangles.scad index 37157d8..0735cc3 100644 --- a/triangles.scad +++ b/triangles.scad @@ -2,9 +2,9 @@ * Simple triangles library * * Authors: - * - Eero 'rambo' af Heurlin 2010- + * - Eero 'rambo' af Heurlin 2010- * - * License: GPL 2.0 + * License: LGPL 2.1 */ From fd3da7a8c1970b4cc083f7f9aca2a45e3437c40e Mon Sep 17 00:00:00 2001 From: Eero af Heurlin Date: Thu, 26 Aug 2010 15:08:44 +0800 Subject: [PATCH 3/3] 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); +