2023-11-11 14:21:39 -05:00
|
|
|
$fn = 72;
|
2023-11-11 04:28:53 -05:00
|
|
|
|
2023-11-11 04:24:21 -05:00
|
|
|
pcb_width = 257.175;
|
|
|
|
pcb_height = 95.250;
|
|
|
|
|
2023-11-11 14:21:39 -05:00
|
|
|
module keyboard_base_plate(pcb_width, pcb_height) {
|
|
|
|
pcb_clearance_edge = 1.0;
|
|
|
|
pcb_clearance_bottom = 2.0;
|
2023-11-11 15:59:01 -05:00
|
|
|
|
|
|
|
thickness = 1.0;
|
|
|
|
corner_radius = thickness / 2.0;
|
2023-11-11 04:24:21 -05:00
|
|
|
|
2023-11-11 15:59:01 -05:00
|
|
|
module round_corner(translation, rotation) {
|
2023-11-11 14:21:39 -05:00
|
|
|
translate(translation)
|
|
|
|
rotate(rotation)
|
|
|
|
rotate_extrude(angle=90) {
|
|
|
|
intersection() {
|
|
|
|
circle(r=corner_radius);
|
|
|
|
square(corner_radius*2);
|
|
|
|
}
|
2023-11-11 04:24:21 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-11 15:59:01 -05:00
|
|
|
module round_edge(length, translation, rotation) {
|
2023-11-11 14:21:39 -05:00
|
|
|
translate(translation)
|
|
|
|
rotate(rotation)
|
|
|
|
linear_extrude(length)
|
2023-11-11 04:24:21 -05:00
|
|
|
intersection() {
|
2023-11-11 04:28:53 -05:00
|
|
|
circle(r=corner_radius);
|
|
|
|
square(corner_radius*2);
|
2023-11-11 04:24:21 -05:00
|
|
|
}
|
|
|
|
}
|
2023-11-11 14:21:39 -05:00
|
|
|
|
2023-11-11 15:37:03 -05:00
|
|
|
/* Lower left corner */
|
2023-11-11 15:59:01 -05:00
|
|
|
round_corner([0 - pcb_clearance_edge,
|
|
|
|
0 - pcb_clearance_edge, 0], [-90, 90, 90]);
|
2023-11-11 14:21:39 -05:00
|
|
|
|
2023-11-11 15:37:03 -05:00
|
|
|
/* Upper left orner */
|
2023-11-11 15:59:01 -05:00
|
|
|
round_corner([0 - pcb_clearance_edge,
|
|
|
|
pcb_clearance_edge + pcb_height, 0], [0, 90, 90]);
|
2023-11-11 14:21:39 -05:00
|
|
|
|
2023-11-11 15:37:03 -05:00
|
|
|
/* Upper right corner */
|
2023-11-11 15:59:01 -05:00
|
|
|
round_corner([pcb_clearance_edge + pcb_width,
|
|
|
|
pcb_clearance_edge + pcb_height, 0], [90, 90, 90]);
|
2023-11-11 14:21:39 -05:00
|
|
|
|
2023-11-11 15:37:03 -05:00
|
|
|
/* Lower right corner */
|
2023-11-11 15:59:01 -05:00
|
|
|
round_corner([ pcb_clearance_edge + pcb_width,
|
|
|
|
0 - pcb_clearance_edge, 0], [180, 90, 90]);
|
2023-11-11 14:21:39 -05:00
|
|
|
|
|
|
|
/* Top edge */
|
2023-11-11 15:59:01 -05:00
|
|
|
round_edge( 2 * pcb_clearance_edge + pcb_width,
|
|
|
|
[0 - pcb_clearance_edge,
|
|
|
|
pcb_clearance_edge + pcb_height, 0], [0, 90, 0]);
|
2023-11-11 15:37:03 -05:00
|
|
|
|
2023-11-11 14:21:39 -05:00
|
|
|
/* Right edge */
|
2023-11-11 15:59:01 -05:00
|
|
|
round_edge( 2 * pcb_clearance_edge + pcb_height,
|
|
|
|
[ pcb_clearance_edge + pcb_width,
|
|
|
|
0 - pcb_clearance_edge, 0], [270, 0, 0]);
|
2023-11-11 15:37:03 -05:00
|
|
|
|
2023-11-11 14:21:39 -05:00
|
|
|
/* Bottom edge */
|
2023-11-11 15:59:01 -05:00
|
|
|
round_edge(2 * pcb_clearance_edge + pcb_width,
|
|
|
|
[0 - pcb_clearance_edge,
|
|
|
|
0 - pcb_clearance_edge, 0], [90, 180, 90]);
|
2023-11-11 15:37:03 -05:00
|
|
|
|
2023-11-11 14:21:39 -05:00
|
|
|
/* Left edge */
|
2023-11-11 15:59:01 -05:00
|
|
|
round_edge( 2 * pcb_clearance_edge + pcb_height,
|
|
|
|
[0 - pcb_clearance_edge,
|
|
|
|
0 - pcb_clearance_edge, 0], [270, 90, 0]);
|
2023-11-11 14:21:39 -05:00
|
|
|
|
2023-11-11 15:59:01 -05:00
|
|
|
linear_extrude(thickness)
|
|
|
|
translate([0 - pcb_clearance_edge,
|
|
|
|
0 - pcb_clearance_edge, 0])
|
|
|
|
square([2 * pcb_clearance_edge + pcb_width,
|
|
|
|
2 * pcb_clearance_edge + pcb_height],
|
|
|
|
false);
|
2023-11-11 14:21:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
keyboard_base_plate(pcb_width, pcb_height);
|