7 module RecessScrewCutout_RecessCylinder(recessdia,zbelow, h){
8 translate([0,0,-zbelow]) cylinder(r=recessdia/2, h=h+1, $fn=40);
11 RecessedScrewCutout_defaultrecessdepth_flat = -0.30;
12 RecessedScrewCutout_defaultrecessdepth_hex = -0.60;
14 function RecessedScrewCutout_recessdepth(recessdia,
15 recessdepth_arg=RecessedScrewCutout_defaultrecessdepth_flat) =
16 recessdepth_arg >= 0 ? recessdepth_arg : -recessdepth_arg * recessdia;
18 function RecessedScrewCutout_totaldepth(recessdia,
19 recessdepth_arg=RecessedScrewCutout_defaultrecessdepth_flat) =
20 RecessedScrewCutout_recessdepth(recessdia, recessdepth_arg) +
21 + 0.5*recessdia + 0.1;
23 module RecessedScrewCutout(shaftdia, recessdia, shaftlen,
25 recessdepth_arg=RecessedScrewCutout_defaultrecessdepth_flat) {
26 // pass recessdepth_arg=-1 for the default for flat heads
27 // pass recessdepth_arg=-1 for the default for flat heads
28 recessdepth = RecessedScrewCutout_recessdepth(recessdia, recessdepth_arg);
29 recesstopz = RecessedScrewCutout_totaldepth(recessdia, recessdepth_arg);
31 translate([0,0,-zbelow]) cylinder(r=shaftdia/2, h=shaftlen+zbelow, $fn=20);
32 RecessScrewCutout_RecessCylinder(recessdia,zbelow, recessdepth);
34 cube([recessdia + 1, shaftdia + 0.1, recesstopz*2 + 1], center=true);
35 translate([0, -recessdia, recesstopz])
36 rotate([0,135,0]) cube([recessdia, recessdia*2, 10]);
37 RecessScrewCutout_RecessCylinder(recessdia,zbelow, recesstopz+1);
42 tests = [[2 + 0.5, 4 + 1.0, 4, -4 ],
43 [3 + 0.5, 6 + 1.0, 0, 10 ],
44 [4 + 0.5, 8 + 1.0, 0, 25 ],
45 [5 + 0.5, 10 + 1.0, 17, 4 ],
46 [6 + 0.5, 12 + 1.0, 17, 20 ]];
48 last_test = tests[len(tests)-1];
59 h = RecessedScrewCutout_totaldepth(t[1]) + 3;
61 translate([-blocksz/2, -blocksz/2, 0])
62 cube([blocksz, blocksz, h]);
63 RecessedScrewCutout(t[0],t[1], h+1);
69 translate([t[2], t[3], 0])