Skip to content

Instantly share code, notes, and snippets.

@hrobeers
Last active October 21, 2015 07:58
Show Gist options
  • Save hrobeers/c0280ccdc7930e414ee7 to your computer and use it in GitHub Desktop.
Save hrobeers/c0280ccdc7930e414ee7 to your computer and use it in GitHub Desktop.
// Parameters
length = 10;
rocker_curve = 3;
$fn = 100;
dia=length/PI;
include<rocker.scad>
// pic 11: intersect
intersection() {
// pic 10: rotate cylinder in place
rotate([0,90,-asin(dia/length)])
// pic 9: cylinder
cylinder(h=length,d=dia,center=true);
// pic 8: center
translate([-length/2,0,-dia/2])
// pic 7: extrude to thickness
linear_extrude(dia)
// pic 6: scale to length
scale([length,length])
rocker(0.3, rocker_curve);
}
// Uncomment lines below to preview module
//rocker();
//$fn=50;
module rocker(f_depth=1, curve=3)
{
angle=atan(1/curve);
// pic 5: normalize to length 1
scale([sin(angle),sin(angle)*f_depth])
// pic 4: rotate to x-axis
rotate([0,0,-angle])
// pic 3: scale to ellipse
scale([curve,1])
difference() {
// pic 1: base circle
translate([1,0])
circle();
// pic 2: cut circle at 45deg
rotate([0,0,-45])
translate([0,-1])
scale([2,3])
square();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment