$fs=0.5; $fa=20; include <../common/nut.scad> include <../common/gcube.scad> ee=0.2; m8_head_d=15.6+3*ee; m8_head_depth=6; // just for calculating interference m8_nut_ftf=13.1+3*ee; m8_hole_d=7.9+3*ee; m8_extra_r=9.0; // outer diameter of meat around m8 // measured horiz spacing of wood: 38.8mm // ideal: 20+7.8+7+7-0.8-0.8=40.2 m8_horiz_spacing=40.2; // +1.6mm to -1mm? l_m8_x=-m8_horiz_spacing/2; tl_m8_y=25; bl_m8_y=-25; r_m8_x=m8_horiz_spacing/2; r_m8_y=-9; platform_depth=5; back_nut_depth=9; m3_hole_d=2.9+2*ee; m3_ftf=5.4+3*ee; arm_head_d=10; arm_horiz_spacing=40.4; armatt_x=arm_horiz_spacing/2; armatt_y=tl_m8_y-(m8_head_d+arm_head_d)/2; armatt_z=13; armatt_screw_len=19; // M3x20 measured length armatt_width=armatt_screw_len-7; armatt_h1=13; armatt_h2=m3_hole_d+2; armatt_nut_depth=3.9; // M3 nyloc belt_z=14.6-1.2; beltatt_merge_depth=belt_z-3; belt_depth=6; beltatt_width1=2.5; beltatt_width2=5; beltatt_height=8; beltatt_biggap=4; beltatt_littlegap=1.7; beltatt_x1=2; beltatt_x2=beltatt_x1+beltatt_width1+beltatt_littlegap; beltatt_y1=armatt_y-(m3_ftf/2+beltatt_height); beltatt_y2=beltatt_y1-(beltatt_height+beltatt_biggap); beltatt_hole_z=belt_z+belt_depth+m3_ftf/2; beltatt_depth=beltatt_hole_z+m3_ftf/2; crossplat_head_d=5.3+ee; // 4-40 x 1.5" crossplat_screw_d=2.8+ee*2; crossplat_screw_len=38; crossplat_nut_depth=2.4+ee*2; crossplat_nut_ftf=6.1+ee*3; crossplat_nut_ofs=crossplat_screw_len-4; crossplat_y1=r_m8_y+m8_extra_r+crossplat_head_d/2; crossplat_y2=r_m8_y-(m8_extra_r+crossplat_head_d/2); plat1_x=l_m8_x; plat1a_x=armatt_x-armatt_width; plat1_y=armatt_y-armatt_h1/2; plat1_width=(plat1a_x-plat1_x)+0.01; plat1a_width=armatt_width; plat1_height=armatt_h1; plat1a_height=armatt_h1/2; plat2_right_x=armatt_x+1-armatt_width; plat2_x=l_m8_x; plat3_y=crossplat_y2-crossplat_head_d/2; plat2_y=plat3_y-2; plat2_width=plat2_right_x-plat2_x; plat2_height=plat1_y+0.1-plat2_y; platform_gap=2; plat3_x=plat2_x+plat2_width+platform_gap; plat3_width=plat1a_x+plat1a_width+3-plat3_x; plat3_back_height=m8_extra_r*2+crossplat_head_d*2; plat3_front_less=0.4; plat3_height=plat3_back_height-plat3_front_less; plat2_back_height=plat3_back_height+4; crossplat_depth=6; crossplat_z=crossplat_depth/2; crossplat_nut_x=plat3_x+plat3_width-crossplat_nut_ofs; crossplat_hole_x=plat3_x+plat3_width-(crossplat_screw_len+2); echo("plat3_width", plat3_width); if ((part == 1) || (part == 3)) { // front-left (main piece) difference() { union() { platform_left(); arm_attach(); mirror([1,0,0]) arm_attach(); belt_attach(); } m8_holes_left(); crossplat_holes(); arm_attach_holes(); mirror([1,0,0]) arm_attach_holes(); belt_attach_holes(); } } if ((part == 2) || (part == 3)) { // front-right difference() { union() { platform_right(); } m8_holes_right(); crossplat_holes(); } } if ((part == 4) || (part == 12)) { // back-left mirror([1,0,0]) difference() { union() { back_left(); } m8_holes_back_left(); crossplat_holes(); } } if ((part == 8) || (part == 12)) { // back-right mirror([1,0,0]) difference() { union() { back_right(); } m8_holes_back_right(); crossplat_holes(); } } module platform_left() { // circles around the screw holes translate([l_m8_x, tl_m8_y, 0]) cylinder(r=m8_extra_r, h=platform_depth); translate([l_m8_x, bl_m8_y, 0]) cylinder(r=m8_extra_r, h=platform_depth); // connect the two m8 holes translate([l_m8_x-m8_extra_r, bl_m8_y, 0]) cube([m8_extra_r*2, tl_m8_y-bl_m8_y, platform_depth]); // connecting the arm holders translate([plat1_x, plat1_y, 0]) cube([plat1_width, plat1_height, platform_depth]); translate([plat1a_x, plat1_y, 0]) cube([plat1a_width, plat1a_height, platform_depth]); translate([plat2_x, plat2_y, 0]) cube([plat2_width, plat2_height, platform_depth]); // and a bit of strengthening around the M8 holes ngon(p=[[l_m8_x, tl_m8_y+m8_extra_r], [l_m8_x+20, plat1_y+plat1_height-0.1], [l_m8_x, plat1_y+plat1_height-0.1]], h=platform_depth); ngon(p=[[l_m8_x, bl_m8_y-m8_extra_r], [l_m8_x+20, plat2_y+0.1], [l_m8_x, plat2_y+0.1]], h=platform_depth); // a bit of strengthening around the crossplat holes translate([crossplat_nut_x, crossplat_y1-8/2, 0]) cube([plat2_x+plat2_width-crossplat_nut_x, 8, crossplat_depth]); translate([crossplat_nut_x, crossplat_y2-8/2, 0]) cube([plat2_x+plat2_width-crossplat_nut_x, 8, crossplat_depth]); } module m8_holes_left() { translate([l_m8_x, tl_m8_y, -0.1]) cylinder(r=m8_hole_d/2, h=platform_depth+0.2); translate([l_m8_x, tl_m8_y, platform_depth-0.2]) cylinder(r=m8_head_d/2, h=20); translate([l_m8_x, bl_m8_y, -0.1]) cylinder(r=m8_hole_d/2, h=platform_depth+0.2); translate([l_m8_x, bl_m8_y, platform_depth-0.2]) cylinder(r=m8_head_d/2, h=20); } module platform_right() { // circle around m8 translate([r_m8_x, r_m8_y, 0]) cylinder(r=m8_extra_r, h=platform_depth); // boxy part translate([plat3_x, plat3_y, 0]) cube([plat3_width, plat3_height, crossplat_depth]); // a bit of strengthening around the crossplat holes translate([plat3_x, crossplat_y1-crossplat_head_d/2, 0]) cube([plat3_width, crossplat_head_d-plat3_front_less, crossplat_depth]); translate([plat3_x, crossplat_y2-crossplat_head_d/2, 0]) cube([plat3_width, crossplat_head_d, crossplat_depth]); // translate([r_m8_x, r_m8_y+m8_head_d/2, platform_depth+m8_head_depth]) // cube([1, armatt_y-(r_m8_y+m8_head_d/2), // armatt_z-(platform_depth+m8_head_depth)]); echo("interfere #1 down=", armatt_y-(r_m8_y+m8_head_d/2), "outside=", armatt_z-(platform_depth+m8_head_depth)); echo(" (ideally: down >= 6, outside >= -0.2)"); } module m8_holes_right() { translate([r_m8_x, r_m8_y, -0.1]) cylinder(r=m8_hole_d/2, h=platform_depth+0.2); translate([r_m8_x, r_m8_y, platform_depth-0.2]) cylinder(r=m8_head_d/2, h=20); } module arm_attach() { translate([armatt_x, armatt_y, armatt_z]) rotate([0,-90,0]) cylinder(r1=armatt_h2/2, r2=armatt_h1/2, h=armatt_width); ngon(p=[[armatt_x-armatt_width, armatt_y+armatt_h1/2], [armatt_x, armatt_y+armatt_h2/2], [armatt_x, armatt_y-armatt_h2/2], [armatt_x-armatt_width, armatt_y-armatt_h1/2]], h=armatt_z); } module arm_attach_holes() { translate([armatt_x+0.1, armatt_y, armatt_z]) rotate([0,-90,0]) cylinder(r=m3_hole_d/2, h=armatt_width+0.2); translate([armatt_x-(armatt_width+0.1), armatt_y, armatt_z]) rotate([0,90,0]) hex_nut(m3_ftf, armatt_nut_depth); } module belt_attach() { // top left translate([beltatt_x1, beltatt_y1, 0]) cube([beltatt_width1, beltatt_height, beltatt_depth]); // top right translate([beltatt_x2, beltatt_y1, 0]) cube([beltatt_width2, beltatt_height, beltatt_depth]); // bottom left translate([beltatt_x1, beltatt_y2, 0]) cube([beltatt_width1, beltatt_height, beltatt_depth]); // bottom right translate([beltatt_x2, beltatt_y2, 0]) cube([beltatt_width2, beltatt_height, beltatt_depth]); // base translate([beltatt_x1, beltatt_y2, 0]) cube([beltatt_x2+beltatt_width2-beltatt_x1, beltatt_y1+beltatt_height-beltatt_y2, beltatt_merge_depth]); // translate([beltatt_x2+beltatt_width2, beltatt_y2, beltatt_depth]) // cube([armatt_x-(beltatt_x2+beltatt_width2), // armatt_y-beltatt_y2, 1]); echo("interfere #2: left=", armatt_x-(beltatt_x2+beltatt_width2), "down=", armatt_y-beltatt_y2); echo(" (ideally: left >= 7, down <= 31)"); } module belt_attach_holes() { translate([beltatt_x2+beltatt_width2+0.1, beltatt_y1+beltatt_height/2, beltatt_hole_z]) rotate([0,-90,0]) hex_nut(m3_ftf, m3_nut_thick); translate([beltatt_x2+beltatt_width2+0.1, beltatt_y2+beltatt_height/2, beltatt_hole_z]) rotate([0,-90,0]) hex_nut(m3_ftf, m3_nut_thick); translate([beltatt_x1-0.1, beltatt_y1+beltatt_height/2, beltatt_hole_z]) rotate([0,90,0]) cylinder(r=m3_hole_d/2, h=beltatt_width1+beltatt_littlegap+beltatt_width2+0.2); translate([beltatt_x1-0.1, beltatt_y2+beltatt_height/2, beltatt_hole_z]) rotate([0,90,0]) cylinder(r=m3_hole_d/2, h=beltatt_width1+beltatt_littlegap+beltatt_width2+0.2); // and have a little overhang in case it extends into the way of the // right part translate([plat2_right_x, beltatt_y2, 0]) cube([5, plat1_y-beltatt_y2, crossplat_depth+1]); } module crossplat_holes() { // screw holes translate([crossplat_hole_x, crossplat_y1, crossplat_z]) rotate([0,90,0]) cylinder(r=crossplat_screw_d/2, h=crossplat_screw_len+5); translate([crossplat_hole_x, crossplat_y2, crossplat_z]) rotate([0,90,0]) cylinder(r=crossplat_screw_d/2, h=crossplat_screw_len+5); // nut traps translate([crossplat_nut_x, crossplat_y1-crossplat_nut_ftf/2, -0.1]) cube([crossplat_nut_depth, crossplat_nut_ftf, crossplat_depth+1]); translate([crossplat_nut_x, crossplat_y1, crossplat_z]) rotate([0,90,0]) hex_nut(crossplat_nut_ftf, crossplat_nut_depth); translate([crossplat_nut_x, crossplat_y2-crossplat_nut_ftf/2, -0.1]) cube([crossplat_nut_depth, crossplat_nut_ftf, crossplat_depth+1]); translate([crossplat_nut_x, crossplat_y2, crossplat_z]) rotate([0,90,0]) hex_nut(crossplat_nut_ftf, crossplat_nut_depth); } module back_left() { // circles around the M8 holes translate([l_m8_x, tl_m8_y, 0]) cylinder(r=m8_extra_r, h=back_nut_depth); translate([l_m8_x, bl_m8_y, 0]) cylinder(r=m8_extra_r, h=back_nut_depth); // connect the two m8 holes translate([l_m8_x-m8_extra_r, bl_m8_y, 0]) cube([m8_extra_r*2, tl_m8_y-bl_m8_y, platform_depth]); translate([plat2_x, plat2_y, 0]) cube([plat2_width, plat2_back_height, platform_depth]); // and a bit of strengthening around the M8 holes ngon(p=[[l_m8_x, tl_m8_y+m8_extra_r], [l_m8_x+30, plat2_y+plat2_height-0.1], [l_m8_x, plat2_y+plat2_height-0.1]], h=platform_depth); ngon(p=[[l_m8_x, bl_m8_y-m8_extra_r], [l_m8_x+20, plat2_y+0.1], [l_m8_x, plat2_y+0.1]], h=platform_depth); // a bit of strengthening around the crossplat holes translate([crossplat_nut_x, crossplat_y1-8/2, 0]) cube([plat2_x+plat2_width-crossplat_nut_x, 8, crossplat_depth]); translate([crossplat_nut_x, crossplat_y2-8/2, 0]) cube([plat2_x+plat2_width-crossplat_nut_x, 8, crossplat_depth]); } module m8_holes_back_left() { translate([l_m8_x, tl_m8_y, -0.1]) cylinder(r=m8_hole_d/2, h=platform_depth+0.2); translate([l_m8_x, tl_m8_y, platform_depth]) hex_nut(m8_nut_ftf, 20); translate([l_m8_x, bl_m8_y, -0.1]) cylinder(r=m8_hole_d/2, h=platform_depth+0.2); translate([l_m8_x, bl_m8_y, platform_depth]) hex_nut(m8_nut_ftf, 20); } module back_right() { // circle around m8 translate([r_m8_x, r_m8_y, 0]) cylinder(r=m8_extra_r, h=back_nut_depth); // boxy part translate([plat3_x, plat3_y, 0]) cube([plat3_width, plat3_back_height, crossplat_depth]); // a bit of strengthening around the crossplat holes translate([plat3_x, crossplat_y1-crossplat_head_d/2, 0]) cube([plat3_width, crossplat_head_d-plat3_front_less, crossplat_depth]); translate([plat3_x, crossplat_y2-crossplat_head_d/2, 0]) cube([plat3_width, crossplat_head_d, crossplat_depth]); } module m8_holes_back_right() { translate([r_m8_x, r_m8_y, -0.1]) cylinder(r=m8_hole_d/2, h=platform_depth+0.2); translate([r_m8_x, r_m8_y, platform_depth]) hex_nut(m8_nut_ftf, 20); }