summaryrefslogtreecommitdiff
path: root/prototype/mech_pcbs/flange_holder_frame.scad
blob: bec16c1ab19ecb6d7f98d28d9c257850d9bc0bb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* Linear units are mm */

ext_dia = 40.0;
int_dia = 6.2;
h = 8;

cyl_dia = 14.0;
cyl_h = 20.0;

mnth_dia = 4.2;
mnth_ins_dia = 8;
mnth_ins_h = 2.0;
mnth_center_r = 12.0;
mnth_num = 2;

seth_dia = 3.2;
//seth_ins_dia = mnth_ins_dia;
//seth_ins_h = mnth_ins_h;
seth_ins_dia = 6.2;
seth_ins_h = 8.0;
seth_num = 2;

nut_w = 5.35 + 0.2;
nut_h = 6.05 + 0.2;
nut_d = 2.5;
nut_offr = 6.0;

$fn = 64;

difference() {
    union() {
        intersection() {
            cylinder(d=ext_dia, h=h);
            translate([-ext_dia/2, -10.0, 0]) cube([ext_dia, 20.0, h]);
        }
        cylinder(d=cyl_dia, h=cyl_h);
    }
    
    cylinder(d=int_dia, h=cyl_h);
    
    for (alpha = [0 : 360/mnth_num : 359.9999]) {
        rotate(alpha, [0, 0, 1])
        translate([-mnth_center_r, 0, 0])
        union() {
            cylinder(d=mnth_dia, h=cyl_h);
            translate([0, 0, h-mnth_ins_h]) cylinder(d=mnth_ins_dia, h=mnth_ins_h+cyl_h-h);
        }
    }
    
    for (alpha = [ 0 : 360/max(seth_num, 4) : 359.9999 * seth_num/max(seth_num, 4)]) {
        translate([0, 0, h/2])
        rotate(alpha + 360/mnth_num/4, [0, 0, 1])
        union() {
            translate([-nut_offr, 0, 0]) {
                cube([nut_d, nut_w, nut_h], center=true);
                translate([0, 0, -h/2])
                cube([nut_d, nut_w, h/2], center=true);
            }
            
            rotate(-90, [0, 1, 0])
            union() {
                cylinder(d=seth_dia, h=ext_dia/2);
                translate([0, 0, ext_dia/2-seth_ins_h]) cylinder(d=seth_ins_dia, h=seth_ins_h);
            }
        }
    }
}