Skip to content

Instantly share code, notes, and snippets.

@hrobeers
Created October 22, 2015 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrobeers/2a7da96a587d9ca5b9b0 to your computer and use it in GitHub Desktop.
Save hrobeers/2a7da96a587d9ca5b9b0 to your computer and use it in GitHub Desktop.
Second attempt at using Malaroo's techique in OpenSCAD
// Parameters
length = 10;
rocker_curve = 3;
thick_rot = 7;
$fn = 100;
include<rocker.scad>
include<outline.scad>
// Intersect stringer & outline
intersection()
{
stringer();
outline_cut();
}
// Top & bottom rocker
module stringer()
{
// extrude
translate([0,0,-length/2])
linear_extrude(length)
// project
projection()
// rotate to generate thickness projection
rotate([thick_rot, 0, 0])
outline(length, rocker_curve);
}
// Extruded outline
module outline_cut()
{
// rotate back
rotate([-90,0,0])
// extrude centered
translate([0,0,-length/2])
linear_extrude(length)
// project outline
projection()
rotate([90,0,0])
outline(length, rocker_curve);
}
// Uncomment lines below to preview module
//outline(10,3);
//$fn=50;
//include<rocker3.scad>
module outline(length, rocker_curve)
{
dia=length/PI;
intersection() {
// rotate cylinder in place
rotate([0,90,-asin(dia/length)])
// cylinder: diameter = width
cylinder(h=length,d=dia,center=true);
// center
translate([-length/2,0,-dia/2])
// extrude to thickness
linear_extrude(dia)
// scale to length
scale([length,length])
rocker(0.3, rocker_curve);
}
}
// Uncomment lines below to preview module
//rocker();
//$fn=50;
// Make thin rocker surface
thick = 0.01;
module rocker(f_depth=1, curve=3)
{
angle=atan(1/curve);
// normalize to length 1
scale([sin(angle),sin(angle)*f_depth])
// rotate to x-axis
rotate([0,0,-angle])
// scale to ellipse
scale([curve,1])
difference() {
// base circle
translate([1,0])
circle();
// cut circle at 45deg
rotate([0,0,-45])
translate([0,-1])
scale([2,3])
square();
// cut to thin arc
translate([1+thick,0-thick])
circle();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment