summaryrefslogtreecommitdiff
path: root/prototype/mech_pcbs/flange_holder.scad
blob: d926ef954cdfaa1d9eedefbf130ba2cddd8c0084 (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
/* Parametric flange model */

/* All units are millimeters */

$fn = 64;

num_mounting_holes = 4;
mounting_hole_dia = 2.7;
/* center of shaft to center of mounting holes */
mounting_hole_shaft_radius = 8.0;
mounting_hole_cutout_dia = 5.0;
base_height = 4.0;
base_dia_extra = 2.0;
base_dia = 2*mounting_hole_shaft_radius + 2*base_dia_extra + mounting_hole_dia;

shaft_holder_height = 20.0;
shaft_holder_dia = 14.0;

shaft_dia = 4.0;

grubscrew_count = 1;
grubscrew_heights = 2;
grubscrew_hole_dia = 3.2;
grubscrew_insert_dia = 6.5;
grubscrew_insert_height = 3.0;
grubscrew_lowest_offset = 5.0;
grubscrew_pitch = 10.0;

difference() {
    union() {
        difference() {
            cylinder(h=base_height, d=base_dia);
            for ( alpha = [ 0 : 360 / num_mounting_holes : 360 ] ) {
                rotate(alpha, [0, 0, 1])
                translate([-mounting_hole_shaft_radius, 0, 0])
                cylinder(h=base_height, d=mounting_hole_dia);
            }
        }

        difference() {
            cylinder(h=shaft_holder_height, d=shaft_holder_dia);
            cylinder(h=shaft_holder_height, d=shaft_dia);
            /* cutouts for mounting hole screw heads */
            for ( alpha = [ 0 : 360 / num_mounting_holes : 360 ] ) {
                rotate(alpha, [0, 0, 1])
                translate([-mounting_hole_shaft_radius, 0, 0])
                cylinder(h=shaft_holder_height, d=mounting_hole_cutout_dia);
            }
        }
    }

    rotate(-90, [0, 1, 0]) {
        for ( alpha = [ 0 : 360 / grubscrew_count : 360 ] ) {
            for ( i = [ 0 : grubscrew_heights] ) {
                rotate(alpha + (360 / num_mounting_holes/2), [1, 0, 0])
                translate([grubscrew_lowest_offset + i*grubscrew_pitch, 0, 0]) {
                    cylinder(d=grubscrew_hole_dia, h=base_dia/2); 
                    cylinder(d=grubscrew_insert_dia, h=grubscrew_insert_height + shaft_dia/2);
                }
            }
        }
    }
}