openscad-parts/stekkerding/stekkerding.scad
2014-01-21 16:20:22 +01:00

108 lines
2.2 KiB
OpenSCAD

// asdfadsf
radius = product_of_the_triangle_side_lengths / area_of_the_triangle_multiplied_by_4;
FN=80*1;
width_shortest = 40;
width_longest = 60;
height = 40;
wall_thickness = 3;
max_length = 30;
// Gotta do some mathematics
triangle_height = (width_longest - width_shortest) / 2;
triangle_width = height / 2;
slanted_side = sqrt(pow(triangle_height, 2) + pow(triangle_width,2));
product_triangle_sides = slanted_side * slanted_side * height;
triangle_area = (height*triangle_height)/2;
radius_side = product_triangle_sides / (4 * triangle_area);
echo(str("Radius: ", radius_side));
module body(radius_sides, body_height, body_width, inner){
intersection(){
intersection(){
translate([0,0,-body_height/2]){
cube([body_width,100,body_height]);
}
union(){
translate([radius_sides,0,0]){
rotate([-90,0,0]){
cylinder(h=100, r=radius_sides, $fn=FN);
}
}
translate([body_width-radius_sides,0,0]){
rotate([-90,0,0]){
cylinder(h=100, r=radius_sides, $fn=FN);
}
}
}
}
union(){
translate([0,radius_sides,-body_height/2]){
cube([body_width,100,body_height]);
}
if (inner == 1) {
translate([0,radius_sides,0]){
rotate([0,90,0]){
cylinder(h=100, r=radius_sides, $fn=FN);
}
}
} else {
translate([0,0,-body_height/2]){
cube([body_width,100,body_height]);
}
}
}
}
}
module shell(){
intersection(){
difference(){
body(radius_side + wall_thickness*2, height + wall_thickness*2, width_longest + wall_thickness*2);
translate([wall_thickness, wall_thickness, 0]){
body(radius_side, height, width_longest, 1);
}
}
translate([0,0,-(height+wall_thickness*2)/2]){
cube([width_longest+ wall_thickness*2,max_length,height+wall_thickness*2]);
}
}
}
module screwdown(){
difference(){
cube([15+radius_side,15,wall_thickness]);
translate([7.5,7.5,0]){
screw_hole();
}
}
}
module screw_hole() {
// screw head that I measured maxes at 7mm
// screw thread is 3.5 mm
head = 7;
thread = 3.5 + 0.5;
translate([0,0,-20]){
cylinder(h=30, r=thread/2, $fn=FN);
}
translate([0,0,btn-(thread/2)]){
cylinder(h=head-(thread/2), r1=thread/2, r2=head);
}
}
shell();
translate([-15,0,-(height+wall_thickness*2)/2]){
screwdown();
}