scad/atreusball.scad

149 lines
3.8 KiB
OpenSCAD

$ball_radius = 12;
$bearing_id = 3;
$bearing_od = 5;
$bearing_width = 2;
$tower_width = 5;
$tower_height = 8;
$tower_underhang = 2;
$tower_backin = -1 * $tower_underhang;
$brace_height = $tower_width + 3;
$laser_board_d = 31;
$ardu_board_t = 1.5;
$brace_thick = 2;
module ball_and_sensor() {
union() {
translate([0,0,17]) sphere(r=$ball_radius);
cylinder(h=2, d=$laser_board_d);
translate([-7, -7, -3]) cube([14,14,3]);
// TODO refine and round these edges
translate([-10.5, -8.5, 2]) cube([21,17,2]);
}
}
module atreus_safezone(h=1) {
translate([-14, 0,0])
color("red")
linear_extrude(h)
polygon([[0, 17],
[0, -17],
[33, -12.5],
[55, -30],
[55, 30],
[33, 12.5]
]);
}
module bearing() {
$fn=16;
translate([0,0,-$bearing_width]) cylinder(h=$bearing_width, d=$bearing_od);
}
module tower() {
$fn = 14;
difference() {
union () {
// tower
hull() {
cylinder(h=$tower_width, d=$bearing_od);
translate([$tower_underhang,-1,0]) cylinder(h=$tower_width, d=$bearing_id);
translate([$tower_underhang, $tower_height, 0]) cube([$bearing_od, 8, $tower_width]);
}
// sidecar
translate([0,$tower_height-$brace_thick, -2]) cube([$bearing_od, 8+$brace_thick, 2]);
}
translate([0,0,-1]) cylinder(h=$tower_width+2, d=$bearing_id);
}
}
module position_tower(final_z_rot) {
rotate([0,0,final_z_rot])
translate([-13,-$tower_width/2])
translate([0,0,$tower_height+$bearing_id])
rotate([90,180,0])
children();
}
module board_hookup($board_h=1.2) {
translate([0,$tower_width,0])
difference() {
translate([0, 0, -2*$board_h+0.397])
cube([3*$board_h, $tower_width, 5*$board_h]);
translate([$board_h, -0.1, $board_h])
cube([2*$board_h+0.1, $tower_width + 0.2, $board_h]);
}
}
module round_under() {
$overlap=6;
$radius=26;
$fn=50;
translate([0,0,$overlap-$radius])
sphere(r=$radius);
}
module jiggle(deg, x_jiggle=0, y_jiggle=0) {
rotate([0,0,deg])
translate([x_jiggle,y_jiggle])
rotate([0,0,-1*deg])
children();
}
module mocks() {
//color("red") atreus_safezone();
color("green") ball_and_sensor();
color("blue") position_tower(180) bearing();
color("blue") position_tower(60) bearing();
color("blue") position_tower(-60) bearing();
}
// connectors and towers unioned
module ball_towers() {
difference() {
union() {
color("yellow") position_tower(180) tower();
color("yellow") position_tower(-60) tower();
color("orange") jiggle(60, 0 ,$bearing_width+$tower_width) position_tower(60) tower();
$bw = 25;
$bw2 = 28;
difference() {
union() {
color("white") translate([-14, -$bw / 2, 3-$brace_height]) cube([2, $bw, $brace_thick+$brace_height]);
color("grey") rotate([0,0,90]) translate([-14, -$bw2 / 2 - 2, 3-$brace_height]) cube([$bearing_od, $bw2, $brace_thick+$brace_height]);
color("darkgrey") translate([14, -$bw/2, 3-$brace_height]) cube([2 , 20, $brace_thick+$brace_height]);
}
round_under();
}
color("black") translate([11, -14, 3-$brace_height]) cube([$tower_width, $tower_width, $brace_height]);
//round_under();
translate([14 + $tower_underhang + 3, -2.5, -2.5])
board_hookup($ardu_board_t);
}
ball_and_sensor();
// second sensor board but taller to clear the underside of the towers
translate([0,0,-8]) cylinder(h=10, d=$laser_board_d);
// flat plane to clear the area by the G key
translate([-19,-15,-5]) cube([5,30,20]);
}
}
ball_towers();
// mocks();
//translate([0,0,-5]) atreus_safezone(h=30);
/* intersection() { */
/* translate([0,0,-5]) atreus_safezone(h=30); */
/* ball_towers(); */
/* } */