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.2];
40 screw_info_M3 = [3, 1.2];
41 screw_info_M4 = [4, 1.1];
42 screw_info_M5 = [5, 1.0];
43 screw_info_M6 = [6, 1.2];
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.50 + 1.0;
48 function screw_recess_depth(info) = info[0] * 1.00 + 0.50;
49 function screw_recess_depth_allen(info) = info[0] * 1.55 + 0.50;
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;
83 module OneTestCore(t, h, ymul, labelnumber=false){
84 blocksz = Test_blocksz(t);
85 translate([0, ymul * (blocksz*0.5 - 1.5), 0]) {
87 translate([-blocksz/2, -blocksz/2, 0])
88 cube([blocksz, blocksz, h]);
93 translate([-blocksz/4,blocksz/5, blocksz/2-1])
94 linear_extrude(height=0.3+1)
95 import(file=str("screw-recess-test-number-s",t[0],".dxf"), convexity=100);
101 h = RecessedScrewCutoutStandard_totaldepth(t) + 3;
102 ha = RecessedScrewCutoutStandardAllen_totaldepth(t) + 3;
103 OneTestCore(t, h, 1){
104 RecessedScrewCutoutStandard(t, h+1);
106 OneTestCore(t, ha, -1, true){
107 RecessedScrewCutoutStandardAllen(t, ha+1);
111 function Test_x(i) = i<=0 ? 0 :
112 Test_x(i-1) + Test_blocksz(tests[i-1])/2 + Test_blocksz(tests[i])/2 - 3;
115 for (i = [0:len(tests)-1]) {
117 translate([Test_x(i), 0, 0])