/* */ include include include include /* [Params] */ platfoot_x = 51; platfoot_y = 26; platmid_x = 41; headpost_x = 39; headpost_y = 39; footcrossyz = 40; headcross_yz = 26.00; footpost_y = 40; footboard_y=19; footboard_z=130; LegOff = 18; LegGap=4; headcrossgasket=13; cornergasket=5; ring=true; /* [Render Options] */ part=""; // [ none, head_corner_rear, head_corner_front, foot_corner_front, foot_corner_rear, head_cross_front, head_cross_rear, foot_cross_front, foot_cross_rear, foot_cross_spacer, head_cross_gasket, corner_gasket, head_corner_test ] model = "none"; // ["none", "corner_leg", "center_leg"] plate = false; mate = false; render_fs=.8; render_fn=0; render_fa=3; // Set Render Options $fs= ($preview) ? $fs : render_fs; $fn= ($preview) ? $fn : render_fn; $fa= ($preview) ? $fa : render_fa; module platfoot(x=platfoot_x, y=platfoot_y, z=260, align=V_FRONT) { cuboid([x,y,z], align=align); } module footboard(x=100, y=footboard_y, z=footboard_z, align=V_BACK+V_BOTTOM) { cuboid([x,y,z], align=align); } module headpost(x=headpost_x, y=headpost_y, z=260, align=V_FRONT) { cuboid([x,y,z], align=align); } module screw_channel() { fwd(80)rotate([-90,180,0])m4s_clear(bl=100, drop=false); } module head_rear(ring=ring) { blockz=headcross_yz+2*10; difference() { union() { left(LegOff/2+4)back(footboard_y) cuboid([ platfoot_x+16+LegOff, headpost_y+footboard_y, blockz], fillet=3, edges=EDGES_BACK+EDGES_Y_ALL, align=V_FRONT+V_TOP); if (ring) { fwd(10)up(blockz/2)right(40-4)rotate([90,0,-45])rotate_extrude(angle=360) left(18) circle(d=10); } } //%footboard(); headpost(y=2*headpost_y); left(44)up(blockz/2)cuboid([50, 150,headcross_yz]); // crossbar // Screw Holes rx = 5 + headpost_x/2; right(rx)up(blockz-5) screw_channel(); right(rx)up(blockz/2) screw_channel(); right(rx)up(5) screw_channel(); left(50)up(blockz-5) screw_channel(); left(50)up(5) screw_channel(); } } module head_front() { blockz=headcross_yz + 2*10; difference() { right(LegOff/2-4)cuboid([ platfoot_x+16+LegOff, platfoot_y+footboard_y, blockz ], fillet=3, edges=EDGES_FRONT+EDGES_Y_ALL, align=V_FRONT+V_TOP); back(.01) platfoot(); // Screw HolesXTFei 14 Inch Heavy Duty Platform Bed Frame rx= platfoot_y + (16+LegOff)/2; bz = -40; bl = 58 - bz; up(blockz/2) { zspread(n=3, l=blockz-10) right(rx) rotate([-90,180,0]) m4s_clear(bl=bl, bz=bz, drop=true, sh=0); zspread(n=2, l=blockz-10) left(50-LegOff) rotate([-90,180,0]) m4s_clear(bl=bl, bz=bz, drop=true, sh=0); } } } module corner_gasket(yd=cornergasket) { blockz=headcross_yz+2*10; difference() { left(LegOff/2+4) cuboid([ platfoot_x+16+LegOff, 5, blockz], fillet=2 ); rx = 5 + headpost_x/2; right(rx)zspread(n=3, l=blockz-10) screw_channel(); left(50)zspread(n=2, l=blockz-10) screw_channel(); } } module foot_front() { blockz= footcrossyz + 2*10; // 95; difference() { right(LegOff/2-4)cuboid([platfoot_x+16+LegOff,platfoot_y+footboard_y,blockz], fillet=3, edges=EDGES_FRONT+EDGES_Y_ALL, align=V_FRONT+V_TOP); back(.01)platfoot(); // Screw Holes rx= 5 + headpost_x/2; bz = -40; bl = 58 - bz; up(blockz/2)zspread(n=3, l=blockz-10) right(rx+LegOff) rotate([-90,0,0]) rotate([0,0,180]) m4s_clear(bl=bl, bz=bz, drop=true, sh=0); up(blockz/2)left(30) zspread(n=2, l=blockz-10) rotate([-90,0,0]) rotate([0,0,180]) m4s_clear(bl=bl, bz=bz, drop=true, sh=0); } } module foot_rear() { blockz=headcross_yz+2*10; z = footcrossyz + 2*10; difference() { union() { left(LegOff/2+4)back(footboard_y) cuboid([platfoot_x+16+LegOff,headpost_y+footboard_y, z], fillet=3, edges=EDGES_BACK+EDGES_Y_ALL, align=V_FRONT+V_TOP); fwd(10)up(z/2)right(40-4)rotate([90,0,-45])rotate_extrude(angle=360) left(18) circle(d=10); } footboard(); headpost(x=footpost_y, y=2*footpost_y); left(44)up(z/2)cuboid([50, 150, footcrossyz]); // crossbar // Screw Holes //rx = 5 + headpost_x/2; //rx= platfoot_y + (16+LegOff)/2; rx = 5 + headpost_x/2; right(rx)up(z-5) screw_channel(); right(rx)up(z/2) screw_channel(); right(rx)up(5) screw_channel(); left(50)up(z-5) screw_channel(); left(50)up(5) screw_channel(); } } module head_cross_gasket(y=headcrossgasket) { difference() { cuboid([platmid_x+20, y, 42], fillet=3,align=V_BACK); xspread(n=2, l=platmid_x+10) zspread(n=2, l=33) fwd(1) rotate([90,0,0]) m4s_clear(bl=66, bz=-34, drop=false, sh=0); } } module head_cross_rear() { difference() { cuboid([platmid_x+20, 25+10, 42], fillet=3,align=V_BACK); back(50/2)cuboid([platmid_x, 50 , 70], align=V_FRONT); xspread(n=2, l=platmid_x+10) zspread(n=2, l=33) rotate([90,0,0]) m4s_clear(bl=66, bz=-34, drop=true, sh=0); } } module head_cross_front() { difference() { cuboid([platmid_x+20, 25+10, 42], fillet=3, align=V_FRONT); back(25)cuboid([71, 50 , 25], align=V_FRONT); xspread(n=2, l=platmid_x+10) zspread(n=2, l=33) rotate([90,0,0]) m4s_clear(bl=65, bz=-33, drop=false, sh=.20); } } module foot_cross_front() { z = footcrossyz + 2*10; difference() { cuboid([platmid_x+20, footcrossyz+10, z], fillet=3, align=V_FRONT); fwd(footcrossyz)cuboid([71, 50 , footcrossyz], align=V_BACK); fwd(footcrossyz)cuboid([footcrossyz, 50 , 71], align=V_BACK+V_TOP); back(6)xspread(n=2, l=platmid_x+10) zspread(n=2, l=z-10) rotate([90,0,0]) rotate([0,0,0]) m4s_clear(bl=65, bz=-12.3, drop=false, sh=.20); } } module foot_cross_rear() { z = footcrossyz + 2*10; difference() { cuboid([platmid_x+20, footcrossyz+10, z], fillet=3,align=V_BACK); back(50/2)cuboid([platmid_x, 50 , 70], align=V_FRONT); back(0)xspread(n=2, l=platmid_x+10) zspread(n=2, l=z-10) rotate([90,0,0]) m4s_clear(bl=67, bz=-22, drop=false, sh=0); } } module foot_cross_spacer() { z = footcrossyz + 2*10; difference() { cuboid([platmid_x+20, 5,z], fillet=2); back(10)xspread(n=2, l=platmid_x+10) zspread(n=2, l=z-10) rotate([90,0,0]) rotate([0,0,0]) m4s_clear(bl=65, bz=-19, drop=false, sh=.20); } } module head_cross_bar(l=100, align=V_FRONT) { cuboid([l,headcross_yz, headcross_yz], align=align); } module head_plat_mid(l=100, align=V_BACK) { cuboid([platmid_x, platfoot_y, l], align=align); } if (part == "head_cross_front") { rot = (plate) ? 90 : 0; zt = plate ? headcross_yz + 10 : 0; up(zt) rotate([rot,0,0]) { head_cross_front(); if (mate) { %head_cross_rear(); } } } else if (part == "foot_cross_front") { rot = (plate) ? 90 : 0; zt = plate ? footcrossyz +10 : 0; up(zt) rotate([rot,0,0]) { foot_cross_front(); if (mate) { %foot_cross_rear(); } } } else if (part == "foot_cross_rear") { rot = (plate) ? -90 : 0; zt = plate ? platfoot_y+10 : 0; up(zt) rotate([rot,0,0]) { foot_cross_rear(); if (mate) { %foot_cross_front(); } } } else if (part == "head_cross_rear") { rot = (plate) ? 0 : 0; zt = plate ? headcross_yz/2 + 10 : 0; up(zt) rotate([rot,0,0]) { head_cross_rear(); if (mate) { %head_cross_front(); } } } else if (part == "head_corner_front") { tx = (plate) ? 0 : -LegOff; ty = (plate) ? 0 : -headpost_y-4; translate([tx, ty, 0]) head_front(); if (mate) right(LegOff)back(38)%head_rear(); } else if (part == "head_corner_rear") { rot = plate ? -90 : 0; upoff = plate ? footboard_y : 0; up(upoff) xrot(rot) { head_rear(); if (mate) fwd(38) left(LegOff)%head_front(); } } else if (part == "foot_corner_front") { rot = plate ? 0 : 0; xrot(rot) foot_front(); } else if (part == "foot_corner_rear") { rot = plate ? -90 : 0; zt = plate ? footboard_y : 0; up(zt) xrot(rot) { foot_rear(); if (mate) { fwd(headpost_x) left(LegOff) %foot_front(); } } } else if (part == "both") { fwd(platfoot_y+LegGap+13) left(LegOff)head_front(); head_rear(); } else if (part == "head_cross_gasket") { rot = plate ? 90 : 0; xrot(rot) head_cross_gasket(); } else if (part == "foot_cross_spacer") { rot = plate ? 90 : 0; xrot(rot) foot_cross_spacer(); } else if (part == "corner_gasket") { blockz=headcross_yz + 2*10; rot = plate ? 90 : 0; xrot(rot) { corner_gasket(); if (mate) { down(blockz/2)fwd(headpost_x) left(LegOff) %head_front(); } } } module leg_corner() { %footboard(); %headpost(); %left(LegOff)fwd(headpost_y+LegGap)platfoot(); } if (model == "corner_leg") { %leg_corner(); } else if (model == "center_leg") { %head_cross_bar(); %head_plat_mid(); }