3 module RecessScrewCutout_RecessCylinder(recessdia,zbelow, h){
4 translate([0,0,-zbelow]) cylinder(r=recessdia/2, h=h+1, $fn=40);
7 RecessedScrewCutout_defaultrecessdepth_flat = -0.30;
8 RecessedScrewCutout_defaultrecessdepth_hex = -0.60;
10 function RecessedScrewCutout_recessdepth(recessdia,
11 recessdepth_arg=RecessedScrewCutout_defaultrecessdepth_flat) =
12 recessdepth_arg >= 0 ? recessdepth_arg : -recessdepth_arg * recessdia;
14 function RecessedScrewCutout_totaldepth(recessdia,
15 recessdepth_arg=RecessedScrewCutout_defaultrecessdepth_flat) =
16 RecessedScrewCutout_recessdepth(recessdia, recessdepth_arg) +
17 + 0.5*recessdia + 0.1;
19 module RecessedScrewCutout(shaftdia, recessdia, shaftlen,
21 recessdepth_arg=RecessedScrewCutout_defaultrecessdepth_flat) {
22 // pass recessdepth_arg=-1 for the default for flat heads
23 // pass recessdepth_arg=-1 for the default for flat heads
24 recessdepth = RecessedScrewCutout_recessdepth(recessdia, recessdepth_arg);
25 recesstopz = RecessedScrewCutout_totaldepth(recessdia, recessdepth_arg);
27 translate([0,0,-zbelow]) cylinder(r=shaftdia/2, h=shaftlen+zbelow, $fn=20);
28 RecessScrewCutout_RecessCylinder(recessdia,zbelow, recessdepth);
30 cube([recessdia + 1, shaftdia + 0.1, recesstopz*2 + 1], center=true);
31 translate([0, -recessdia, recesstopz])
32 rotate([0,135,0]) cube([recessdia, recessdia*2, 10]);
33 RecessScrewCutout_RecessCylinder(recessdia,zbelow, recesstopz+1);
39 screw_info_M2 = [2, 1.5];
40 screw_info_M3 = [3, 1.5];
41 screw_info_M4 = [4, 1.2];
42 screw_info_M5 = [5, 1.0];
43 screw_info_M6 = [6, 0.9];
45 function screw_shaft_dia_nom(info) = info[0];
46 function screw_shaft_dia_use(info) = info[0] + info[1];
47 function screw_recess_dia_use(info) = info[0] * 2.5;
48 function screw_recess_depth(info) = info[0] * .65;
49 function screw_recess_depth_allen(info) = info[0] * 1.20;
51 function RecessedScrewCutoutStandard_totaldepth(info) =
52 RecessedScrewCutout_totaldepth(screw_recess_dia_use(info),
53 screw_recess_depth(info));
55 function RecessedScrewCutoutStandardAllen_totaldepth(info) =
56 RecessedScrewCutout_totaldepth(screw_recess_dia_use(info),
57 screw_recess_depth_allen(info));
59 module RecessedScrewCutoutStandard(info, shaftlen, zbelow=1) {
60 RecessedScrewCutout(screw_shaft_dia_use(info),
61 screw_recess_dia_use(info),
63 screw_recess_depth(info));
66 module RecessedScrewCutoutStandardAllen(info, shaftlen, zbelow=1) {
67 RecessedScrewCutout(screw_shaft_dia_use(info),
68 screw_recess_dia_use(info),
70 screw_recess_depth_allen(info));
81 function Test_blocksz(t) = screw_recess_dia_use(t) + 7;
84 blocksz = Test_blocksz(t);
85 h = RecessedScrewCutoutStandard_totaldepth(t);
87 translate([-blocksz/2, -blocksz/2, 0])
88 cube([blocksz, blocksz, h]);
89 RecessedScrewCutoutStandard(t, h+1);
93 function Test_x(i) = i<=0 ? 0 :
94 Test_x(i-1) + Test_blocksz(tests[i-1])/2 + Test_blocksz(tests[i])/2 - 3;
97 for (i = [0:len(tests)-1]) {
99 translate([Test_x(i), 0, 0])