Skip to content

Commit 10bd70b

Browse files
committed
cad: check in the CH552-36 pcb outline
1 parent 6b7092a commit 10bd70b

File tree

1 file changed

+137
-0
lines changed

1 file changed

+137
-0
lines changed
+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
$fn = 32;
2+
3+
switch_unit = 19.05;
4+
5+
highlight_switch_cutout = true;
6+
highlight_switch_outline = true;
7+
8+
function grid_coord(r, c) = [switch_unit, 0] * c + [0, switch_unit] * r;
9+
10+
module switch(
11+
) {
12+
square(size = 19.05, center = true);
13+
if (highlight_switch_cutout) {
14+
%square(size = 14, center = true);
15+
}
16+
if (highlight_switch_outline) {
17+
%square(size = 19.05, center = true);
18+
}
19+
}
20+
21+
// origin = unstaggered sw_1_1's middle
22+
module column_staggered_switch_grid(
23+
num_rows = 3,
24+
num_cols = 5,
25+
stagger = [0, 0, 0, 0, 0],
26+
) {
27+
for (row = [0:num_rows - 1]) {
28+
for (col = [0:num_cols - 1]) {
29+
translate(grid_coord(r = row, c = col) + [0, stagger[col]]) {
30+
switch();
31+
}
32+
}
33+
}
34+
}
35+
36+
module fanned_thumb_cluster(
37+
fanned_angle = 10,
38+
) {
39+
rotate([0, 0, fanned_angle]) {
40+
switch();
41+
42+
half_u = switch_unit / 2;
43+
44+
// Could recurse here for more than 1 thumb key to the right
45+
translate([half_u, half_u]) {
46+
rotate([0, 0, fanned_angle]) {
47+
translate([half_u, -half_u]) {
48+
switch();
49+
}
50+
}
51+
}
52+
// Could recurse here for more than 1 thumb key to the left.
53+
translate([-half_u, half_u]) {
54+
rotate([0, 0, -fanned_angle]) {
55+
translate([-half_u, -half_u]) {
56+
switch();
57+
}
58+
}
59+
}
60+
}
61+
}
62+
63+
// Come up with a rounded base hull
64+
// for split keyboards
65+
module pcb_outline_hull(
66+
num_rows = 3,
67+
num_cols = 5,
68+
stagger = [12, 6, 0, 5.5, 8],
69+
) {
70+
intersection() {
71+
square([100, 100], center = false);
72+
73+
offset(r = 1.5)
74+
offset(r = -1.5)
75+
difference() {
76+
hull() {
77+
intersection() {
78+
square([100, 100], center = false);
79+
80+
union() {
81+
// Switches
82+
translate([6.574, 9.6628]) {
83+
column_staggered_switch_grid(
84+
num_rows = num_rows,
85+
num_cols = num_cols,
86+
stagger = stagger
87+
);
88+
89+
// thumb cluster
90+
translate(grid_coord(r = 1 + 2, c = 3) + [0, stagger[3]] + [9, 7.5]) {
91+
fanned_thumb_cluster();
92+
}
93+
}
94+
95+
// The PCB board shape extends to the USB connector
96+
mock_usb_w = 10;
97+
translate([100 - mock_usb_w, 0]) {
98+
square([mock_usb_w, 8], center = false);
99+
%square([mock_usb_w, 8], center = false);
100+
}
101+
102+
// Add a curve to the outline's top-left
103+
w = 36;
104+
translate([w, 13]) {
105+
rotate([0, 0, 0]) {
106+
scale([2 * w, 26]) {
107+
circle(d = 1);
108+
}
109+
}
110+
}
111+
} // union
112+
} // intersection
113+
} // hull
114+
115+
// Take out a curve from the bottom left
116+
translate([21, 79]) {
117+
rotate([0, 0, 23]) {
118+
scale([48, 10]) {
119+
circle(d = 1);
120+
}
121+
}
122+
}
123+
// Take out a curve from the bottom right
124+
translate([71, 93]) {
125+
rotate([0, 0, 10]) {
126+
scale([55, 8]) {
127+
circle(d = 1);
128+
}
129+
}
130+
}
131+
} // difference
132+
} // intersection
133+
}
134+
135+
scale([1, -1]) {
136+
pcb_outline_hull();
137+
}

0 commit comments

Comments
 (0)