-
Notifications
You must be signed in to change notification settings - Fork 0
/
personal_layout.py
85 lines (63 loc) · 2.64 KB
/
personal_layout.py
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
75
76
77
78
79
80
81
82
#!/usr/bin/env python3.9
from faceplate import *
WIDTH = 16
HEIGHT = 8
BORDER_WIDTH = 3/4
HAND_TILT = 25
KEYCAP_LENGTH = 5/7 # 18.15mm, from spec (pretty close to 23/32" also)
KEYS_DEFAULT_MARGIN = 1/10
KEYS_DIST_DEFAULT = KEYCAP_LENGTH + KEYS_DEFAULT_MARGIN # 13/16 almost exactly
KEYS_DIST_SHORT = KEYCAP_LENGTH + KEYS_DEFAULT_MARGIN / 2 # 3/4 + 1/64 almost exactly
KEYS_DIST_LONG = KEYCAP_LENGTH + KEYS_DEFAULT_MARGIN * 3 / 2
MIDDLE_FINGER_ELEVATION = 7/32
RING_FINGER_DECLINATION = 1/4
PINKY_DECLINATION = 1+1/16
CDOWN_DECLINATION = 3/8
CUP_VERTICAL_DISTANCE = KEYS_DIST_SHORT
EFFECTIVE_BORDER = BORDER_WIDTH + 9/16
if __name__ == '__main__':
l_x = WIDTH / 2 - EFFECTIVE_BORDER - 3/8
l_y = HEIGHT - EFFECTIVE_BORDER + 1/16 - max(
(PINKY_DECLINATION - RING_FINGER_DECLINATION + KEYS_DIST_SHORT) * cosd(HAND_TILT) - KEYS_DIST_DEFAULT * sind(HAND_TILT), # Ring Finger
(PINKY_DECLINATION + KEYS_DIST_SHORT) * cosd(HAND_TILT) - 3 * KEYS_DIST_DEFAULT * sind(HAND_TILT)) # Index Finger
# Right Hand
l = KeyMount(l_x, l_y, HAND_TILT)
z = l.translated(-KEYS_DIST_DEFAULT, PINKY_DECLINATION - RING_FINGER_DECLINATION)
x = z.translated(-KEYS_DIST_DEFAULT, RING_FINGER_DECLINATION + MIDDLE_FINGER_ELEVATION)
r = x.translated(-KEYS_DIST_DEFAULT, -MIDDLE_FINGER_ELEVATION)
ls = l.translated(0, KEYS_DIST_SHORT)
ms = z.translated(0, KEYS_DIST_SHORT)
y = r.translated(0, KEYS_DIST_SHORT)
b = r.translated(0, -KEYS_DIST_LONG)
# Right Thumb
a = r.translated(-(1+7/16), -(2+3/8))
cu = a.translated(-1/4, KEYS_DIST_DEFAULT + 5/16)
cl = cu.translated(-KEYS_DIST_DEFAULT, -5/16)
cr = cu.translated(KEYS_DIST_SHORT, 0)
a = a.rotated(14)
cd = a.translated(-KEYS_DIST_DEFAULT, -3/16).rotated(14)
# Left Hand
rt = r.reflected_horizontal()
dn = x.reflected_horizontal()
lt = z.reflected_horizontal()
up = l.reflected_horizontal()
# Left Thumb
mx = rt.translated((1+1/16), -(2+1/4))
my = mx.translated(KEYS_DIST_SHORT, -3/8).rotated(-14)
# D-pad
du = KeyMount(-2.1, 5.5, -45)
dl = du.translated(0, -(9/8) * KEYS_DIST_DEFAULT)
dr = du.translated((9/8) * KEYS_DIST_DEFAULT, 0)
dd = dl.translated((9/8) * KEYS_DIST_DEFAULT, 0)
# Start
s = KeyMount(-WIDTH/2 + BORDER_WIDTH + 9/16, HEIGHT - BORDER_WIDTH - 9/16)
faceplate = Faceplate(
WIDTH,
HEIGHT,
[
up, dn, lt, rt, a, b, x, y, z, r, l, ls, ms, mx, my, cu, cd, cl, cr, du, dd, dl, dr, s
],
mounting_hole_buffer = 1/4,
mounting_hole_top_distance = 4.8
)
faceplate.to_svg('diyb0xx-personal')