summaryrefslogtreecommitdiff
path: root/gm_platform/platform/lid_switch_plunger_flex.scad
blob: c49e0244c0ecb3e41866e70de1d9645c78d20454 (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
case_inside_h = 54.5;
case_standoff_h = 6.0;
pcb_h = 1.6;
switch_h = 12.2;
glue_h = 0.2;
tolerance = 0.7;
height = case_inside_h - case_standoff_h - pcb_h - switch_h - glue_h - tolerance + 2;

eps = 0.01;
base_w = 20;
base_h = base_w;
base_d = 6;
stem_w = 10;
stem_h = stem_w;
plunger_w = 20;
plunger_h = 25;
plunger_d = 3;

// cylinder chain parameters
c_h = 14;
c_w = base_w;
c_intersect = 1;
c_wall = 0.8;

module narf(w, h, d) {
    translate([0, 0, 1])
    minkowski(){
        cube([w-2*d, h-2*d, eps], center=true);
        cylinder(d, d, 0, $fn=32);
    };

    minkowski(){
        cube([w-2*d, h-2*d, eps], center=true);
        cylinder(1, d, d, $fn=32);
    };
}

rotate ([0, 180, 0]) {
   
    difference() {
        union() {
            narf(base_w, base_h, base_d);
            
            translate([0, 0, height-c_h/2-plunger_d])
            //cube([stem_w, stem_h, height], center=true);
            for (i=[0:1]) {
                rotate([0, 90, 0]) translate([i*(c_h - c_intersect), 0, -c_w/2]) cylinder(d=c_h, h=c_w, $fn=32);
            }
            
            translate([0, 0, height])
            mirror([0, 0, 1])
            narf(plunger_w, plunger_h, plunger_d);
        }
        
        translate([0, 0, height-c_h/2-plunger_d])
        for (i=[0:1]) {
            rotate([0, 90, 0]) translate([i*(c_h - c_intersect), 0, -c_w/2-eps]) cylinder(d=c_h - 2*c_wall, h=c_w+2*eps, $fn=32);
        }
    }
}