From 787a6db031c32c149063300abcdf24e916985fc8 Mon Sep 17 00:00:00 2001 From: Stephen Carpenter Date: Fri, 15 Jan 2021 09:40:59 -0500 Subject: [PATCH] Cleanup and add ball intersections --- Baller.scad | 103 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 68 insertions(+), 35 deletions(-) diff --git a/Baller.scad b/Baller.scad index bb51dbd..ea0a78e 100644 --- a/Baller.scad +++ b/Baller.scad @@ -2,17 +2,26 @@ use use -//$fa = ($preview) ? 12 : .01; -//$fs = ($preview) ? 2 : .01; -//$fn = ($preview) ? 0 : 27; +$fa = ($preview) ? 12 : 1; +$fs = ($preview) ? 2 : 1; $incolor = false; -module ball() { +module ball(insert=true, top = true, bottom = true) { bd=65; difference() { - sphere(d=bd); - translate([0,0,bd/2])thread_insertM3($die=true); - translate([0,0,-bd/2]) rotate(0,180,0) thread_insertM3($die=true); + intersection() { + sphere(d=bd); + for (i = [-1, 1]) + if ((i<0 && bottom) || (i>0 && top)) + translate([0,0,i*bd/2]) + cube([bd, bd, bd],center=true); + } + if (insert) for (iz = [-bd/2, bd/2]) { + rot = (iz < 0) ? 180 : 0; + //translate([0,0,bd/2])thread_insertM3($die=true); + translate([0,0,iz]) + rotate([0,rot,0]) thread_insertM3($die=true); + } } } @@ -26,8 +35,12 @@ module underball() { translate([0,0,-48]) sphere(d=100, $fa=3); } - translate([0,0,5]) cylinder(d=55, h=10, center=true); - translate([0,0,9]) rotate_extrude(angle=360) translate([10+15/2,0,0])circle(d=20); + translate([0,0,5]) + cylinder(d=55, h=10, center=true); + translate([0,0,9]) + rotate_extrude(angle=360) + translate([10+15/2,0,0]) + circle(d=20); } module ring(d,id) { @@ -38,55 +51,69 @@ module ring(d,id) { //underball(); BallD = 65; -module top(bd) { - color($incolor ? "yellow" : undef) cylinder(d=95, h=4); +module top( + bd, + c_base = $incolor ? "yellow" : undef, + c_seal = $incolor ? "red" : undef, + c_ins = $incolod ? "silver" : undef +) { + color(c_base) cylinder(d=95, h=4); translate([0,0,4]) { difference() { - color($incolor ? "lightblue" : undef) sphere(d=bd); + color(c_base) sphere(d=bd); translate([0,0,-70/2])cylinder(d=95, h=70/2); } cylinder(d=10, id=bd/2); - color($incolor ? "red" : undef) ring(d=5, id=bd+5); + color(c_seal) ring(d=5, id=bd+5); cylinder(d=8, h=bd/2+5); } - difference() { - union() { - cylinder(d=100, h=1+8); - } - translate([0,0,1+8-8])metric_thread(diameter=95,length=8.01, internal=true); + cylinder(d=100, h=1+8); + translate([0,0,1+8-8]) + metric_thread(diameter=95,length=8.01, internal=true); - cylinder(d=92, h=1+6); - } + cylinder(d=92, h=1+6); } -module middle_top(bd) { +module middle_top( + bd, + c_base = $incolor ? "yellow" : undef, + c_seal = $incolor ? "red" : undef, + c_ins = $incolod ? "silver" : undef +) { difference() { - color($incolor ? "yellow" : undef) cylinder(d=95, h=4); - translate([0,0,4]) color($incolor ? "red" : undef ) ring(d=5, id=bd+5); + color(c_base) cylinder(d=95, h=4); + translate([0,0,4]) + color(c_seal) + ring(d=5, id=bd+5); } translate([0,0,4]) { difference() { - color("lightblue") sphere(d=bd); + color(c_base) sphere(d=bd); translate([0,0,-70/2])cylinder(d=95, h=70/2); } cylinder(d=10, id=bd/2); cylinder(d=8, h=bd/2+4); } difference() { - union() { - cylinder(d=100, h=1+8); - } - translate([0,0,1+8-8])metric_thread(diameter=95,length=8.01, internal=true); + cylinder(d=100, h=1+8); + translate([0,0,1+8-8]) + metric_thread(diameter=95, length=8.01, internal=true); cylinder(d=92, h=1+6); } } -module middle_bottom(bd) { +module middle_bottom( + bd, + c_base = $incolor ? "yellow" : undef, + c_seal = $incolor ? "red" : undef, + c_ins = $incolod ? "silver" : undef + +) { difference() { - color($incolor ? "yellow" : undef) cylinder(d=95, h=4); - translate([0,0,4]) color($incolor ? "red" : undef) ring(d=5, id=bd+5); + color(c_base) cylinder(d=95, h=4); + translate([0,0,4]) color(c_seal) ring(d=5, id=bd+5); } translate([0,0,4]) { underball(); @@ -120,7 +147,13 @@ module middle(bd, bh=20) { } } -translate([100,100]) top(bd=BallD); -middle(bd=BallD); -translate([0,100]) middle_bottom(bd = BallD); -translate([100,0]) middle_top(bd = BallD); +module plate_full() { + translate([100,100]) top(bd=BallD); + middle(bd=BallD); + translate([0,100]) middle_bottom(bd = BallD); + translate([100,0]) middle_top(bd = BallD); +} + +//plate_full(); + +ball(bottom=false);