// bendtest3 module joint(x=0,y=0,d=0){ translate([x,y])circle(d=d); } module part(x1=0,y1=0,x2=0,y2=0,d1=0,d2=0){ // length of part l=sqrt(((x2-x1)*(x2-x1))+ ((y2-y1)*(y2-y1))); // angle of part o/h=s a=asin((y2-y1)/l); $fn=50; joint(x1,y1,d1); // joint(x2,y2,d2); //polygon translate([x1,y1]) rotate([0,0,a]) polygon(points=[[0,-d1/2],[l,-d2/2],[l,d2/2],[0,d1/2]]); } module top_view(){ //lever top 1 thick //y is centre line dimensions from drawing // 0,1.25 2.5,1.25, 48.5,4.125, 59,4.125, 63.5,1.625, 90,1.625 part(0,-1.25,2.5,-1.25,1,1); part(2.5,-1.25,48.5,-4.125,1,1); part(48.5,-4.125,59,-4.125,1,1); part(59,-4.125,63.5,-1.625,1,1); part(63.5,-1.625,90,-1.625,1,1); //loop at end always left to right /* part(90,-1.625,90,-3.625,1,1); part(85,-1.625,85,-3.625,1,1); part(85,-3.625,90,-3.625,1,1); joint(90,-3.625,1); */ //solid loop 3.5 wide, say // part(86,-2.8,88.5,-2.8,3.,3.); // joint(88.5,-2.8,3); } module loop() { // revised tail end to allow for angle (could be drawn some other way, but this is more than good enough, most likely will be a solid blob when printed) translate([0,0,-50]) linear_extrude(100,convexity=10){ //top view part(63.5,-1.625,90,-1.625,1,1); part(90,-1.625,90,-3.625,1,1); part(85,-1.625,85,-3.625,1,1); part(85,-3.625,90,-3.625,1,1); joint(90,-3.625,1); } } module tail() { //gets end with loop at angle translate([3.2,0,19])rotate([0,16,0]) //fiddle around to line it up, more or less intersection(){ loop(); rotate([90,0,0]) linear_extrude(100,convexity=10) part(69.5,1.25,91,1.25,2.5,2); // last section longer when straight since distances on drawing after bending // (91 instead of 90) } } module front_view(){ // from bottom edge 0,2, d=4, 69.5,1.25, d=2.5 90,4.5,d=2 part(0,2,69.5,1.25,4,2.5); part(69.5,1.25,90,-4.5,2.5,2); } module merge(){ intersection(){ translate([0,0,-50]) linear_extrude(100,convexity=10) top_view(); rotate([90,0,0])linear_extrude(100,convexity=10) front_view(); } } $fn=50; difference(){ union(){ merge(); translate([0,0,2])rotate([90,0,0])cylinder(1.75,d=4); } translate([0,10,2])rotate([90,0,0])cylinder(50,d=1.25*1.58,$fn=4); //sq hole } tail();