// table //have boards 4.75 x 1.25 inches ht = 22; //height to top of table width = 5*4.75; //top width 23.75 length = 24; //top length thick = 1.25; //top thickness legw = 2.25; //leg width legt = 1.25 ; //leg thickness railt = 1.25; //rail thickness raild = 3; //rail depth bolt = 0.5; //pivot bolt diameters rl = width*0.8; //length of rail dar = length*0.3; //distance apart of rails from centre of top length //dp = width*.35; //distance from centre for mounting holes in rails dp=8; module top(){ translate([0,0,thick/2]) cube([length,width,thick],true); } top(); module rail(){ translate([0,0,raild/2+thick]) cube([railt,rl,raild],true); } module floor_chop(){ cu=100; translate([0,0,(0.5*cu)+ht]) cube(cu,true); } //floor_chop(); module rails(){ translate([dar,0,0]) rail(); translate([-dar,0,0])rail(); } //rails(); module pivot(){ rotate([0,90,0]) cylinder(length,d=bolt); } module pivots(){ translate([-length/2,-dp,thick+(raild/2)]) pivot(); translate([-length/2,dp,thick+(raild/2)]) pivot(); } difference(){ rails(); pivots(); } module centre(){ translate([-length/2,0,(ht+thick+(raild/2))/2]) pivot(); } //centre(); // angle = atan(o/a) // o = (ht-thick-(raild/2))/2 // a= width*.35 // leg length = 2*sqrt(o*o+a*a) from pivot to floor op=(ht-thick-(raild/2))/2; ad =dp; function ang()= atan(op/ad); function leg()= 2*sqrt((op*op) +(ad*ad)); module aleg(){ translate([0,0,op+thick+raild/2]) rotate([ang(),0,0]) cube ([legt,leg(),legw],true); } //aleg(); $fn=50; module chop(){ translate([legw/2,-cos(ang())*legw/2,-20]) rotate([0,0,ang()]) cube(100); } module hinged_leg(){ difference(){ union(){ translate([0,-leg()/2,0])rotate ([0,90,0]) cube ([legt,leg(),legw],true); translate ([0,-leg(),-legt/2]) cylinder(legt,d=legw); //add to length translate([0,leg()/2.5,0]) cube([legw,leg(),legt],true); } chop(); translate([0,-leg(),-20])cylinder(50,d=bolt); translate([0,-leg()/2,-20])cylinder(50,d=bolt); } } translate([length,0,0])hinged_leg(); translate([0.8*length,0,0])hinged_leg(); extra = (raild/2)/sin(ang()); module slide_leg(){ intersection(){ chop(); difference(){ union(){ translate([0,leg()+extra,0])hinged_leg(); translate([0,0,0]) cube([legw,leg(),legt],true); } translate([0,0+extra,-20])cylinder(50,d=bolt); } } } //translate ([length +5*legt,-leg()-extra,0])slide_leg(); translate ([length *1.5,-leg()-extra,0])slide_leg(); translate ([length *1.34,-leg()-extra,0])slide_leg(); function end()=(tan(90-ang()))*legw; cut_len = ((ht-thick)/sin(ang()))+end(); rd2=raild/2; offs= ((legw/2)/cos(ang())); block =(width/2)-dp; toblock= (-rd2*tan(ang())+block)- offs; #translate([offs,0])square(toblock); echo("from table edge to block",toblock); //check lengths //# translate ([length *1.8,-leg()-extra,0])cube([1,cut_len,1]); echo("---------------- Cutting List ------------------"); echo( "height to top of table",ht); echo( "top width",width); echo("top length",length); echo("top thickness",thick); echo("leg width",legw); echo("leg thickness",legt); echo("length of slide leg",cut_len); echo ("leg angle ", ang()); echo ("pivot hole distance from centre of bottom of leg bevel", leg()/2); echo ("pivot hole seperation for leg",leg()/2); echo("rail thickness",railt); echo("rail depth",raild); echo("length of rail",rl); echo ("distance from edge of table to end of rail",(width-rl)/2); echo("distance between holes in rail",dp*2); echo ("distance from end of rail to hole",(rl-(dp*2))/2); echo("from table edge to block",toblock); echo("------------------------------------------------"); text_start=([15,30]); font_size=.8; module echot(a,t,p){ ft="DejaVu Sans Mono"; sz=font_size; // font size fs=sz*1.5; // font spacing translate([text_start.x,text_start.y-fs*p]) color("black")text (str(a,", ",t),size=sz,font=ft,valign="top"); } echot("---------------- Cutting List ------------------",0,0); echot( "height to top of table",ht,1); echot( "top width",width,2); echot("top length",length,3); echot("top thickness",thick,4); echot("leg width",legw,6); echot("leg thickness",legt,7); echot("length of slide leg",cut_len,8); echot ("leg angle ", ang(),9); echot ("pivot hole distance from centre of bottom of leg bevel", leg()/2,10); echot ("pivot hole seperation for leg",leg()/2,11); echot("rail thickness",railt,13); echot("rail depth",raild,14); echot("length of rail",rl,15); echot ("distance from edge of table to end of rail",(width-rl)/2,16); echot("distance between holes in rail",dp*2,17); echot ("distance from end of rail to hole",(rl-(dp*2))/2,18); echot("from table edge to block",toblock,19); echot("------------------------------------------------",0,20);