/* A connector for a speaker support */ use <../cadlib.h> // allviews holder printholder printside // allviews testholders testholder1 testholder2 testtight1 testtight2 testtights include ray2=34.5/2+0.25+0.25; ray1=41.5/2+0.25+0.25; outray=ray1+5; height=72; sloty=5; slotx=4; tightz=18; module tight(screw,screwthick,bolt,head,headthick,support,flat){ lenx=15; leny=26; difference(){ translate([0,-leny/2,-tightz/2]){ cube([lenx,leny,tightz]); translate([lenx,0,tightz/2]) rotate([-90,0,0]) cylinder(r=tightz/2,h=leny); if (support){ translate([0,0,tightz-2]) rotate([-90,0,0]) linear_extrude(leny){ polygon([[0,0],[lenx+6,0],[0,-tightz],[0,0]]); } } } union(){ translate([lenx,-leny/2,0]){ rotate([-90,0,0]) cylinder(r=bolt/2,h=leny,$fn=20); rotate([-90,0,0]) nut(screw,screwthick,flat); } if (head!=0){ translate([lenx,leny/2-headthick,0]) rotate([-90,0,0]) cylinder(r=head/2,h=headthick,$fn=20); } } } } module holder(flatnut){ difference(){ union(){ cylinder(r=outray,h=height,$fn=60); // Put a round top on the cylinder translate([0,0,height-21]) rotate_extrude($fn=40){ translate([outray-5,outray-5,0]) circle(r=5); } // Put the two extrusion use to place the screw translate([ray2,0,tightz/2]) tight(10.25,4,6.50,10,4,true,flatnut); translate([ray2,0,height/2+tightz/2+5.5]) tight(12.25,4,8.5,0,0,true,flatnut); // Put a small holder on top where the metal pin must sit translate([-outray,-5,height])difference(){ cube([10,10,10]); translate([0,5,10]) rotate([0,90,0]) cylinder(r=3,h=15); } } union(){ cylinder(r=ray2,h=height+10,$fn=40); cylinder(r=ray1,h=height/2,$fn=40); translate([sloty+5,-outray,height/2-sloty/2]){ cube([outray,2*outray,sloty]); translate([0,0,sloty/2]) rotate([-90,0,0]) cylinder(r=sloty/2,h=2*outray,$fn=20); } translate([0,-slotx/2,0]) cube([outray+20,slotx,height+10]); } } } module main_view(view){ if (view=="holder"){ holder(false); }else if (view=="printholder"){ translate([0,0,height+5]) rotate([180,0,0]) holder(false); difference(){ cylinder(r=outray+10,h=0.25); cylinder(r=ray1,h=0.25); } }else if (view=="printside"){ translate([0,0,outray]) rotate([90,-90,0]) holder(true); brim=30; translate([-brim,-height-brim,0]) cube([brim*2,height+brim*2,0.8]); }else if (view=="testholder1"){ intersection(){ outray=ray1+30; translate([-outray,-outray,0]) cube([2*outray,2*outray,2]); translate([0,0,-17]) holder(false); } }else if (view=="testholder2"){ intersection(){ outray=ray1+30; translate([-outray,-outray,0]) cube([2*outray,2*outray,2]); translate([0,0,-47]) holder(false); } }else if (view=="testholders"){ intersection(){ outray=ray1+30; translate([-outray,-outray,0]) cube([4*outray,4*outray,2]); union(){ translate([0,0,-42]) holder(false); translate([outray+20,0,0]) holder(false); } } }else if (view=="nut"){ nut(10,5,false); }else if (view=="testtight1"){ translate([0,0,tightz/2]) tight(10,4,6.25,9.5,4,false,false); }else if (view=="testtight2"){ translate([0,0,tightz/2]) tight(12,4,8,0,0,true,false); }else if (view=="testtights"){ translate([0,0,tightz/2]) tight(10,4,6.25,9.5,4,false,false); translate([30,0,tightz/2]) tight(12,4,8,0,0,false,false); } }