include use use use use use $incolor = true; // Config BallDiameter = 65; BallClearance = 4; BallSealWidth = 6; PlateLip = 4; PlateDiameter = BallDiameter + 2*(BallClearance + BallSealWidth + PlateLip); PlateThick = BallSealWidth/2 + 1; PlateSep = 0; /* [Render Options] */ PreviewFA = 12; RenderFA = 1; PreviewFS = 2; RenderFS = .1; $fa = ($preview) ? PreviewFA : RenderFA; $fs = ($preview) ? PreviewFS : RenderFS; //plate_full(); pd = PlateDiameter+PlateSep; pt = PlateThick; wt=BallSealWidth; echo("PD=", pd); //translate([pd+15,0]) plate_top(thickness=pt); //translate([0,pd+15]) plate_mid(thickness=pt); //translate([pd+15,pd+i15]) cap_compression(PlateDiameter, pt+8); //translate([-(pd+15),0]) mold_wall(PlateDiameter, pt, BallDiameter); //bottom(pd=pd); //translate([0,-(pd+5)]) plate_under(); //ball(bottom=false); /*{ bd=BallDiameter; bsd=BallSealWidth; gap=10; w=6; l = 2*(bd+gap+bsd)+gap+w; p4_bottom(); down(12)fwd(l/2 - gap/2 + 3) p4_wall(align=V_TOP); } */ //xrot(90)p4_wall(); p4_top(); module p4_seal_corner(bd=BallDiameter, bsd=BallSealWidth, gap=10) { translate([gap/2+bd/2,gap/2+bd/2,0]) rotate_extrude(angle=90) translate([(bd+bsd+gap)/2,0,0]) circle(d=bsd); } module p4_top(bd=BallDiameter, bsd=BallSealWidth, gap=10) { xspread(l=bd+gap, n=2)yspread(l=bd+gap, n=2) ball(bottom=false); //cyl(h=bd/2, d1=20, d2=10, align=V_TOP); difference() { cuboid([2*(bd+gap+bsd)+gap,2*(bd+gap+bsd)+gap,bsd/2+1], fillet=5, edges=EDGES_Z_ALL,align=V_BOTTOM); p4_seal_corner(); xspread(l=2*(bd+gap+bsd/2)) cyl(h=bd+gap, d=bsd, orient=ORIENT_Y); yspread(l=2*(bd+gap+bsd/2)) cyl(h=bd+gap, d=bsd, orient=ORIENT_X); rot(90)p4_seal_corner(); rot(180)p4_seal_corner(); rot(270)p4_seal_corner(); } } module p4_bottom(bd=BallDiameter, bsd=BallSealWidth, gap=10) { xspread(l=bd+gap, n=2)yspread(l=bd+gap, n=2) ball(bottom=false); xspread(l=2*(bd+gap+bsd/2)) cyl(h=bd+gap, d=bsd, orient=ORIENT_Y); yspread(l=2*(bd+gap+bsd/2)) cyl(h=bd+gap, d=bsd, orient=ORIENT_X); p4_seal_corner(); rot(90)p4_seal_corner(); rot(180)p4_seal_corner(); rot(270)p4_seal_corner(); cuboid([2*(bd+gap+bsd)+gap,2*(bd+gap+bsd)+gap,bsd/2+1], fillet=5, edges=EDGES_Z_ALL,align=V_BOTTOM); } module p4_wall(w=6, bd=BallDiameter, bsd=BallSealWidth, gap=10, orient=ORIENT_X, align=V_CENTER) { h = bd + bsd; l = 2*(bd+gap+bsd)+gap+w/2; orient_and_align([l,w,h], align=align, orient=orient, orig_orient=ORIENT_X) difference() { left(w)cuboid([l, w, h], fillet=1); zspread(n=3, l=h-gap) { yrot(90)up((l-w)/2)insert_clear(bl=10, bz=-10); xrot(90)down(w+4)left((l)/2+3)insert_clear(bl=10, sh=.2, bz=0); } right(0)back(w/2)down(h/2- 10) cuboid([l,w, bsd/2+1.2]); } } module stack(pt, ed=10 ,expand=false) { d = expand ? pt + ed : pt+.01; for (i = [0:$children-1]) { translate([0,0,d*i]) children(i); } } module mold_wall(pd, pt, bd, sd=4, wt=3, $incolor=$incolor) { threadc = $incolor ? "green" : undef; ptol = 2; wh = bd/2+pt+sd; od = pd + 2*wt; difference() { union() { translate([0,0,6]) cylinder(d=od, h=wh); color(threadc) threaded_rod( d=od, l=6, internal=false, align=V_TOP); //color(threadc) metric_thread( // diameter=pd+ptol, // length=4.01, // internal=false); } translate([0,0,-2.1+pt]) cylinder(d1=pd-wt, d2=pd-wt-3, h=wh+6+.2); down(01)cylinder(d=pd, h=pt+.01); } } module bottom(pd, wt=3, wh=10, fh=2) { id = pd + 2*wt + .4; od = id + 2*wt; difference() { cylinder(d=od, h=wh); translate([0,0,fh]) cylinder(d=id, h=wh); } } module cap_compression(pd, pt, th=9, wt=3, register=true, key=false) { td=pd+2*wt; difference() { cylinder(d=td+wt, h=th+wt/2); translate([0,0,th-5-.01]) cylinder(d=3, h=5); translate([0,0,th-1+.01]) cylinder(d=6, h=3); //translate([0,0,2*pt]) metric_thread(diameter=td,length=th+.01, internal=true); translate([0,0,th-1]) threaded_rod(d=td,l=th+.01, internal=true); if (register && ! key) translate([0,0,2*pt-2]) register_seal(); cylinder(d=pd-5,h=10); } if (register && key) translate([0,0,2*pt-2]) register_seal(); } module plate( d=PlateDiameter, thickness = PlateThick) { translate([0,0,-thickness]) cylinder(d=d, h=thickness+.01); } module plate_mid(thickness = 1) { th=thickness; translate([0,0,thickness]) { //ball(bottom=false); difference() { union() { plate(thickness=thickness); register_seal(); } translate([0,0,-thickness]) cylinder(h=10, d=4); ranslate([0,0,-th+.01]) cylinder(d=3, h=5); translate([0,0,-th]) cylinder(d=6, h=3); } } } module plate_top(thickness = 1) { translate([0,0,thickness]) { //ball(bottom=false); difference() { plate(thickness=thickness); register_seal(); translate([0,0,-thickness]) cylinder(h=10, d=4); translate([0,0,-th/2]) cylinder(d=3, h=5); translate([0,0,-thickness-.01]) cylinder(d=6, h=3); } } } module plate_under(thickness = 1) { translate([0,0,thickness]) { underball(); plate(thickness=thickness); register_seal(); } } module ball( bd=BallDiameter, insert=true, top = true, bottom = true) { insertc = $incolor ? "gold" : undef; maxz = top ? bd/2 : 0; minz = bottom ? -bd/2 : 0; echo("maxz:", maxz); echo("minz:", minz); difference() { intersection() { sphere(d=bd); translate([0,0,(maxz+minz)/2]) cube([bd, bd, maxz-minz],center=true); } color(insertc) { if (insert) for (iz = [-bd/2, bd/2]) { rot = (iz < 0) ? 180 : 0; translate([0,0,iz]) rotate([0,rot,0]) thread_insertM25($die=true); } //if (! bottom) // rotate([0,0,0]) // thread_insertM25($die=true); } } } module register_seal( bd = BallDiameter, cl = BallClearance, // Clearance around ball sw = BallSealWidth, // Width of register ) { rotate_extrude() translate([bd/2+cl,0,0]) circle(d=sw); } module underball() { intersection() { translate([0,0,9]) { rotate_extrude(angle=360) translate([10+15/2,0,0]) circle(d=20); translate([0,0,-4]) cylinder(d=55, h=10, center=true); } cylinder(d=70,h=35); } }