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);
38 tests = [[2 + 0.5, 4 + 1.0 ], // shaft came out ~1.0
39 [3 + 0.5, 6 + 1.0 ], // shaft came out ~2.0
40 [4 + 0.5, 8 + 1.0 ], // shaft came out ~3.3
41 [5 + 0.5, 10 + 1.0 ], // shaft came out ~4.5
42 [6 + 0.5, 12 + 1.0 ]]; // shaft came out ~5.4
46 h = RecessedScrewCutout_totaldepth(t[1]) + 3;
48 translate([-blocksz/2, -blocksz/2, 0])
49 cube([blocksz, blocksz, h]);
50 RecessedScrewCutout(t[0],t[1], h+1);
54 function Test_x(i) = i<=0 ? 0 :
55 Test_x(i-1) + tests[i-1][1]*0.5 + tests[i][1]*0.5 + 4.5;
58 for (i = [0:len(tests)-1]) {
60 translate([Test_x(i), 0, 0])