aboutsummaryrefslogtreecommitdiff
path: root/cover.scad
blob: 5615a66ac879141771d7ed24d96c54a9de0dde92 (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
// All dimensions are assumed to be given in millimeters

width = 148;
height = 68;
depth = 2;

function inches_to_mm(inches) = inches * 25.4;

encoder_diameter = 7;

keyboard_offset = 12.5;
encoder_vertical_offset = 12;

vertical_sep = 61;

inner_diameter = inches_to_mm(0.12);
display_width = inches_to_mm(3.8);
display_height = inches_to_mm(2.6);

display_inner_width = 86;
display_inner_height = 2.2 * 25.4;

display_offset = 21;

switch_spacing = 12;

key_offset = encoder_vertical_offset + 14;

button_width = 5.5;

difference() {
    cube([width, height, depth]);

    // Display window
    translate(v=[display_offset, (height - display_inner_height) / 2, -.1]){
        cube([display_inner_width, display_inner_height, depth + .2]);
    }

    // Encoder
    translate(v=[width - keyboard_offset, height - encoder_vertical_offset, depth / 2]){
        cylinder(h=depth + .2, d=encoder_diameter, center=true);
    }

    // Buttons
    for (i=[0:3]) {
        translate(v=[width - keyboard_offset, height - key_offset - i * switch_spacing, depth / 2]){
            cube([button_width, button_width, depth + .2], center=true);
        }
    }
}