Cleanup. Removed vestigial code

Cleanup. Fleshed out all major parts.
This commit is contained in:
2021-01-16 09:39:35 -05:00
parent 787a6db031
commit f1322c070c

View File

@@ -4,19 +4,118 @@ use <threads.scad>
$fa = ($preview) ? 12 : 1; $fa = ($preview) ? 12 : 1;
$fs = ($preview) ? 2 : 1; $fs = ($preview) ? 2 : 1;
$incolor = false; $incolor = true;
module ball(insert=true, top = true, bottom = true) { // Config
bd=65; BallDiameter = 65;
BallClearance = 2;
BallSealWidth = 2;
PlateLip = 2;
PlateDiameter = BallDiameter + 2*(BallClearance + BallSealWidth + PlateLip);
PlateThick = BallSealWidth/2 + 1;
//plate_full();
PlateSep = 0;
pd = PlateDiameter+PlateSep;
pt = PlateThick;
echo("PD=", pd);
translate([pd+5,0]) plate_top(thickness=pt);
translate([0,pd+5]) plate_mid(thickness=pt);
translate([pd+5,pd+5]) cap_compression(PlateDiameter, pt);
translate([-(pd+5),0]) mold_wall(PlateDiameter, pt, BallDiameter);
translate([0,-(pd+5)]) plate_under();
stack(pt, expand=false) {
cap_compression(PlateDiameter, pt);
//plate_under();
//plate_mid(thickness=pt);
plate_top(thickness=pt);
mold_wall(PlateDiameter, pt, BallDiameter);
}
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, wt=3) {
threadc = $incolor ? "green" : undef;
difference() {
union() {
translate([0,0,8]) cylinder(d=pd+wt, h=bd/2+pt-8);
color(threadc) metric_thread(
diameter=pd+wt,
length=8.01,
internal=false);
}
translate([0,0,-.1]) cylinder(d1=pd-1, d2=pd+1, h=bd/2+pt+.2);
}
}
module cap_compression(pd, pt, th=7, wt=3) {
difference() {
cylinder(d=pd+2*wt, h=th);
translate([0,0,-.01]) cylinder(d=pd-6, h=5);
translate([0,0,pt]) metric_thread(diameter=pd+wt,length=th+.01, internal=true);
}
}
module plate(
d=PlateDiameter,
thickness = PlateThick)
{
translate([0,0,-thickness])
cylinder(d=d, h=thickness+.01);
}
module plate_mid(thickness = 1) {
translate([0,0,thickness]) {
ball(bottom=false);
plate(thickness=thickness);
register_seal();
}
}
module plate_top(thickness = 1) {
translate([0,0,thickness]) {
ball(bottom=false);
difference() {
plate(thickness=thickness);
register_seal();
}
}
}
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() { difference() {
intersection() { intersection() {
sphere(d=bd); sphere(d=bd);
for (i = [-1, 1]) translate([0,0,(maxz+minz)/2])
if ((i<0 && bottom) || (i>0 && top)) cube([bd, bd, maxz-minz],center=true);
translate([0,0,i*bd/2])
cube([bd, bd, bd],center=true);
} }
if (insert) for (iz = [-bd/2, bd/2]) { color(insertc) if (insert) for (iz = [-bd/2, bd/2]) {
rot = (iz < 0) ? 180 : 0; rot = (iz < 0) ? 180 : 0;
//translate([0,0,bd/2])thread_insertM3($die=true); //translate([0,0,bd/2])thread_insertM3($die=true);
translate([0,0,iz]) translate([0,0,iz])
@@ -25,135 +124,27 @@ module ball(insert=true, top = true, bottom = true) {
} }
} }
module post() { module register_seal(
translate([0,0,0])cylinder(d=6, h=77, center=true); 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() { module underball() {
translate([0,0,0]) intersection() { intersection() {
cylinder(d=65, h=5, center=true); translate([0,0,9]) {
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) rotate_extrude(angle=360)
translate([10+15/2,0,0]) translate([10+15/2,0,0])
circle(d=20); circle(d=20);
translate([0,0,-4])
cylinder(d=55, h=10, center=true);
} }
cylinder(d=70,h=35);
module ring(d,id) {
rotate_extrude(angle=360) translate([(d+id)/2,0,0])circle(d=d);
}
//ball();
//underball();
BallD = 65;
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(c_base) sphere(d=bd);
translate([0,0,-70/2])cylinder(d=95, h=70/2);
}
cylinder(d=10, id=bd/2);
color(c_seal) ring(d=5, id=bd+5);
cylinder(d=8, h=bd/2+5);
}
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_top(
bd,
c_base = $incolor ? "yellow" : undef,
c_seal = $incolor ? "red" : undef,
c_ins = $incolod ? "silver" : undef
) {
difference() {
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(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() {
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,
c_base = $incolor ? "yellow" : undef,
c_seal = $incolor ? "red" : undef,
c_ins = $incolod ? "silver" : undef
) {
difference() {
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();
cylinder(d=10, id=bd/2);
cylinder(d=8, h=20);
}
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=92, h=1+6);
}
}
// 20 + bd/2+4
module middle(bd, bh=20) {
tot = bd/2 + bh;
th = 2*8;
midl=tot-th;
difference() {
union() {
translate([0,0,8])cylinder(d=100, h=midl);
metric_thread(diameter=95,length=8.01);
translate([0,0,8+midl]) metric_thread(diameter=95,length=8.01);
}
translate([0,0,-.01]) cylinder(d=92, h=tot+1);
} }
} }
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);