forked from pseudoku/PseudoMakeMeKeyCapProfiles
-
Notifications
You must be signed in to change notification settings - Fork 20
/
export_mxspaced_cs.scad
76 lines (65 loc) · 2.61 KB
/
export_mxspaced_cs.scad
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
68
69
70
71
72
73
74
use <MX_Chicago_Steno.scad>
spru_n = 0;
spacing = 19.0 ;
spru_radius = 0.8;
union() {
translate([0, -spacing * 1, 0]) cs_spru(row=2);
// translate([0, -spacing * 1, 0]) cs_spru(row=2, width=1.25);
// translate([0, -spacing * 2, 0]) cs_spru(row=2, width=1.50);
// translate([0, -spacing * 3, 0]) cs_spru(row=2, width=1.75);
// translate([0, -spacing * 4, 0]) cs_spru(row=2, width=2.00);
// translate([0, -spacing * 5, 0]) cs_spru(row=2, width=2.25);
translate([0, -spacing * 0, 0]) cs_spru(row=3);
// translate([0, -spacing * 1, 0]) cs_spru(row=3, width=1.25);
// translate([0, -spacing * 2, 0]) cs_spru(row=3, width=1.50);
// translate([0, -spacing * 3, 0]) cs_spru(row=3, width=1.75);
// translate([0, -spacing * 4, 0]) cs_spru(row=3, width=2.00);
// translate([0, -spacing * 5, 0]) cs_spru(row=3, width=2.25);
}
module cs_spru(row, dot=false, n=spru_n, width=1, radius=spru_radius) {
echo ("Row", row, "width", width);
if (spru_n > 0) {
union() {
for (i = [0 : n - 1]){
translate([i * spacing * width, 0, 0])
mirror([0,0,0])
cs_keycap(row=row, width=width, dot=dot);
}
for (i = [0 : n - 1 - 1]){
translate([width * spacing / 2 - 1.5, 0, -0.9 * spru_radius])
rotate([0, 90, 0])
cylinder(h = 3, r = spru_radius, $fn=12);
}
}
}
else if (spru_n == 0) {
translate([i * spacing, 0, 0])
mirror([0,0,0])
cs_keycap(row=row, width=width, dot=dot);
}
}
module cs_keycap(row, width=1, dot=false) {
if (row == 2 && width == 1 ) {cs_default( 0);}
else if (row == 2 && width == 1.25) {cs_default( 5);}
else if (row == 2 && width == 1.5 ) {cs_default( 7);}
else if (row == 2 && width == 1.75) {cs_default( 9);}
else if (row == 2 && width == 2) {cs_default(11);}
else if (row == 2 && width == 2.25) {cs_default(13);}
else if (row == 3 && width == 1 ) {cs_default( 1);}
else if (row == 3 && width == 1.25) {cs_default( 6);}
else if (row == 3 && width == 1.5 ) {cs_default( 8);}
else if (row == 3 && width == 1.75) {cs_default(10);}
else if (row == 3 && width == 2) {cs_default(12);}
else if (row == 3 && width == 2.25) {cs_default(14);}
}
module cs_default(keyID, dot=false) {
echo("keyID", keyID)
keycap(
keyID = keyID, //change profile refer to KeyParameters Struct
Stem = true, //turns on shell and stems
Dish = true,
visualizeDish=false,
crossSection=false,
homeDot = dot, //turns on homedots
);
}