// allviews link lockpin // printviews link:x3,y3,w35,h25 link:x2,w45 /// viewsopts brim5mm include include <../cadlib.h> len=40; conlen=14; // Connection area between two links width=18; height=15; thick=0.5; ray=2; module link(){ difference(){ union(){ // Larger part cube([len-conlen,width,height]); // Put a floor to help the part stick to bed translate ([0,-2,0]) cube([len-conlen,width+4,0.5]); // part that enter ther larger part translate([len-conlen-2,2.5*thick,0]) cube([conlen+2,width-5*thick,height]); // Pins on each side t3=3*thick; translate([len-2-ray,-t3,height/2]) rotate([-90,0,0]) cylinder(r=ray,h=width+2*t3,$fn=40); } union(){ t2=thick*2; // Remove the inside of the larger part translate([0,t2,t2]) cube([len-conlen-2,width-2*t2,height-t2]); // Remove the inside of the smaller part translate([len-conlen-2,2.5*t2,t2]) cube([len,width-5*t2,height-t2]); translate([0,thick*2,0]) cube([conlen-5,width-4*thick,2*thick]); // Create a hole translate([conlen/3,-thick,height/2]) rotate([-90,0,0]) cylinder(r=ray+0.6,h=width+2*thick,$fn=40); // Make the end round quarter_ray=width/2; translate([len,-1,height]) rotate ([-90,0,0]) quarter_concave(quarter_ray,width+2,40,4); // Triangle hole for the lockpin // A triangle is easier to print translate([len-conlen-6,width+1,height-5]) rotate([90,0,0]){ triangle_isocel(4,4,width+2); triangle_isocel(4.2,4.2,4); } } } } module lockpin(){ translate([-3,0,0]) cube([6,2,4]); // Handle difference(){ rotate([90,0,0]) triangle_isocel (4,4,width+4); union(){ translate([-0.5,-width-4,0]) cube([1,8,4]); translate([0,-width,0]) difference(){ rotate([90,0,0]) triangle_isocel (4,4,1); rotate([90,0,0]) triangle_isocel (3,3,1); } } } } module main_view(view){ if (view=="link"){ link(); }else if (view=="lockpin"){ lockpin(); } }