// allviews top base hook tubel tubep // testviews test-top // printviews top:y2 top,top,hook,base:h30 tubel:x5,w20,h20 tubep:x3,w20,h20 // viewsopts fill80 include include <../cadlib.h> thick=6; module holer(th,ray1,ray2){ translate([0,-1,0]) rotate ([-90,0,0]) cylinder(r=ray1,h=th*2,$fn=20); translate([0,th-1.9,0]) rotate ([-90,0,0]) cylinder(r1=ray1,r2=ray2,h=3.5 ,$fn=40); } module hole(th,small){ if (small){ holer(th,1.5,4); }else{ holer(th,2.4,5); } } module top(){ len=40; width=22; difference(){ union(){ translate([0.5,0,0]) cube([len,thick,width]); translate([0.5+6,thick,0]) cube([len-6,5,width]); } union(){ translate([3*len/7,0,width/2]) hole(thick+5,false); translate([4*len/5,0,width/2]) hole(thick+5,false); } } offx=1; translate ([-thick/4+1,3*thick/2,0]) 3darc (5+thick,thick,width,-40,90+90,40); // Close the space at the end of the arc translate([-2*thick+0.5,thick+3,0]) rotate([0,0,270]) triangle_rectangle(thick+2,thick,width); // Make the base of the arc stronger translate ([3+1,thick*2,0]) rotate ([0,0,-65]) cube ([10,thick-1,width]); } module base(){ len=40; width=16; difference(){ union(){ difference(){ cube([len,width,thick]); union(){ translate([3*len/7,width/2,0]) rotate([90,0,0]) hole(thick,false); translate([4*len/5,width/2,0]) rotate([90,0,0]) hole(thick,false); } } intersection(){ translate([-10,-2,0]) cube([20,20,20]); translate([6,width/2,-3]) rotate ([0,-45,0]) difference(){ translate([0,0,-1]) cylinder(r=10,h=20,$fn=40); union(){ //cylinder(r=6.5,h=20,$fn=40); translate([-20,-10,0]) cube([20,20,20]); } } } } translate([6,width/2,-3]) rotate ([0,-45,0]) translate([0,0,8]) cylinder(r=6.5,h=20,$fn=20); } } module hook(){ len=40; width=12; difference(){ cube([len,thick,width]); union(){ translate([3*len/7,thick+1,width/2]) rotate([180,0,0]) hole(thick,true); translate([4*len/5,thick+1,width/2]) rotate([180,0,0]) hole(thick,true); translate([0,9,width/2]) rotate([0,90,0]) cylinder(r=6.5,h=len,$fn=20); } } translate ([0,2*thick,0]) 3darc (10,thick,width,90,90+90+90,40); } module tube(ray,height){ difference(){ cylinder(r=ray+1,h=height+1,$fn=40); translate([0,0,1]) cylinder(r=ray,h=height,$fn=40); } } module main_view(view){ if (view=="top"){ top(); }else if (view=="test-top"){ intersection(){ len=40; translate([-len/2,0,0]) cube([len*2,len,1]); top(); } }else if (view=="base"){ base(); }else if (view=="hook"){ hook(); }else if (view=="tubel"){ tube(3,12); }else if (view=="tubep"){ tube(2.2,12); } }