function is_die() = (!is_undef($die) && $die); function in_color() = (!is_undef($co) && $co); module insert_clear( bl=4, // Bolt Length (under head) bz=-4, // Bolt offset bhd=6, bhz=3.5, bd=3.5, // Bolt hole diameter fd=5.6, fh=.5, od=4.8, il=3.81, sh=0, drop=false, ) { ic = in_color() ? "gold" : undef; bc = in_color() ? "silver" : undef; ftdside=fd/(2*sqrt(2)); tdside=od/(2*sqrt(2)); // Insert Body translate([0,0,-fh]) color(ic) union() { hull() { cylinder(d=fd, h=fh+.01); if (drop) translate([0,fd/2,fh/2+.01])rotate([0,0,45]) cube([ftdside,ftdside,fh+.01], center=true); } translate([0,0,-(il-fh)]) hull() { cylinder(d=od,h=il-fh-sh); if (drop) translate([0,od/2,(il-fh-sh)/2])rotate([0,0,45])cube([tdside,tdside,il-fh-sh], center=true); } } // Bolt color(bc) { union() { translate([0,0,bl+bz]) cylinder(d=bhd, h=bhz); // bolt head translate([0,0,0]) cylinder(d=bd, h=bl+bz-sh); // bolt translate([0,0,bz]) hull() { cylinder(d=bd, h=-(bz+il)) ; // bolt if (drop) #translate([0,bd/2,-(bz+il)/2+.01])rotate([0,0,45]) cube([ftdside,ftdside,-(bz+il)+.01], center=true); } } } } module m4s_clear( bl=8, bz=-3.81, bhd=6, bhz=3.5, sh=.2, drop=false) { insert_clear(bl=bl, bz=bz, bhd=bhd, bhz=bhz, bd=3.5, fd=5.6, fh=.5, od=4.8, il=3.81, sh=sh, drop=drop); } //m4s_clear(bl=10,bz=-5, drop=true); module m3s_clear( bl=8, bz=-4.7, bhd=7.5, bhz=4, sh=.2) { insert_clear(bl=bl, bz=bz, bhd=bhd, bhz=bhz, bd=4.5, fd=6.35, fh=.5, od=5, il=4.7, sh=sh); } module insert_initeq( bl=4, bz=-4, invertRim=false, fd=5.5, fh=.45, rd=5.75, rh=.8, tdd=4.8, tdn=5.15, bdd=3.5, bdn=2.9, ) { td= is_die() ? tdd : tdn; th=(fh+2*(rh+.5)); ic = in_color() ? "gold" : undef; // Bolt bd = is_die() ? 3.5 : 2.9; bhd = is_die() ? 6.5 : 5.7; bhh = is_die() ? 3.5 : 3; bc = in_color() ? "silver" : undef; color(bc) { translate([0,0,bl+bz]) cylinder(d=bhd, h=bhh); // bolt head translate([0,0,bz-.01]) cylinder(d=bd, h=bl+.02); // bolt } color(ic) difference() { union() { if (! is_die() ) { // Grip Rings translate([0,0,invertRim ? -(rh+th+.05) : -fh]) cylinder(d=fd,h=fh+.01); translate([0,0,-(fh+rh+.5)]) cylinder(d=rd,h=rh); translate([0,0, invertRim ? -(th) : -th]) cylinder(d=rd,h=rh); } else { // top bezel for die translate([0,0,invertRim ? -(rh+th+.05) : -fh]) cylinder(d=5.6, h=fh); } translate([0,0,-(3.9)]) cylinder(d=td,h=3.91); } if (! is_die()) // xxx: threaded hole stand in translate([0,0,-3.95]) cylinder(d=2.9,h=4); } } module thread_insertM3(bl=4, bz=-4, invertRim=false) { fd=5.5; fh=.45; rd=5.75; rh=.8; td= is_die() ? 4.8 : 5.15; th=(fh+2*(rh+.5)); ic = in_color() ? "gold" : undef; // Bolt bd = is_die() ? 3.5 : 2.9; bhd = is_die() ? 6.5 : 5.7; bhh = is_die() ? 3.5 : 3; bc = in_color() ? "silver" : undef; color(bc) { translate([0,0,bl+bz]) cylinder(d=bhd, h=bhh); // bolt head translate([0,0,bz-.01]) cylinder(d=bd, h=bl+.02); // bolt } color(ic) difference() { union() { if (! is_die() ) { // Grip Rings translate([0,0,invertRim ? -(rh+th+.05) : -fh]) cylinder(d=fd,h=fh+.01); translate([0,0,-(fh+rh+.5)]) cylinder(d=rd,h=rh); translate([0,0, invertRim ? -(th) : -th]) cylinder(d=rd,h=rh); } else { // top bezel for die translate([0,0,invertRim ? -(rh+th+.05) : -fh]) cylinder(d=5.6, h=fh); } translate([0,0,-(3.9)]) cylinder(d=td,h=3.91); } if (! is_die()) // xxx: threaded hole stand in translate([0,0,-3.95]) cylinder(d=2.9,h=4); } } module thread_insertM25(bl=4, bz=-4, invertRim=false) { fd=4.44; fh=.45; rd=4.4; rh=.8; td= is_die() ? 3.8 : 4.1; th=(fh+2*(rh+.5)); ic = in_color() ? "gold" : undef; // Bolt bd = is_die() ? 2.75 : 2.5; bhd = 1.5 * bd; bhh = is_die() ? 3 : 2.5; bc = in_color() ? "silver" : undef; color(bc) { translate([0,0,bl+bz]) cylinder(d=bhd, h=bhh); // bolt head translate([0,0,bz-.01]) cylinder(d=bd, h=bl+.02); // bolt } color(ic) difference() { union() { if (! is_die() ) { // Grip Rings translate([0,0,invertRim ? -(rh+th+.05) : -fh]) cylinder(d=fd,h=fh+.01); translate([0,0,-(fh+rh+.5)]) cylinder(d=rd,h=rh); translate([0,0, invertRim ? -(th) : -th]) cylinder(d=rd,h=rh); } else { // top bezel for die translate([0,0,invertRim ? -(rh+th+.05) : -fh]) cylinder(d=fd+.1, h=fh); } translate([0,0,-5.56]) cylinder(d=td,h=5.56); } if (! is_die()) // xxx: threaded hole stand in translate([0,0,-3.95]) cylinder(d=bd+.1,h=4); } } //thread_insertM25(bl=10, $die=false, $co=false, $fs=1);