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 19:47:32 -05:00
|
|
|
|
|
|
|
screw_holes = [
|
|
|
|
[ 4.8150, 85.6188],
|
|
|
|
[ 47.4822, 85.6188],
|
|
|
|
[ 85.8150, 85.6188],
|
|
|
|
[123,8150, 85.6188],
|
|
|
|
[161.8150, 85.6188],
|
|
|
|
[199.8150, 85.6188],
|
|
|
|
[251.3150, 67.1188],
|
|
|
|
[ 22.5650, 47.6187],
|
|
|
|
[118.8150, 47.6187],
|
|
|
|
[157.3150, 47.6187],
|
|
|
|
[ 4.7500, 28.7500],
|
|
|
|
[ 29.7500, 28.7500],
|
|
|
|
[227.8150, 28.7500],
|
|
|
|
[251.8150, 28.7500],
|
|
|
|
[ 42.8150, 9.1188],
|
|
|
|
[ 85.8150, 9.1188],
|
|
|
|
[123.8150, 9.1188],
|
|
|
|
[161.8150, 9.1188],
|
|
|
|
[200.3150, 9.1188]
|
|
|
|
];
|
2023-11-11 04:24:21 -05:00
|
|
|
|
2023-11-11 19:47:32 -05:00
|
|
|
module keyboard_base_plate(pcb_width, pcb_height, screw_holes=[]) {
|
2023-11-11 14:21:39 -05:00
|
|
|
pcb_clearance_edge = 1.0;
|
|
|
|
pcb_clearance_bottom = 2.0;
|
2023-11-11 15:59:01 -05:00
|
|
|
|
2023-11-11 19:47:32 -05:00
|
|
|
pcb_screw_hole_diameter = 1.5;
|
|
|
|
|
2023-11-11 16:50:11 -05:00
|
|
|
thickness = 2.0;
|
2023-11-11 18:12:21 -05:00
|
|
|
wall_height = 14.0;
|
2023-11-11 15:59:01 -05:00
|
|
|
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 18:53:21 -05:00
|
|
|
module round_edge(translation, rotation, length) {
|
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 18:12:21 -05:00
|
|
|
|
|
|
|
module side(translation, dimensions) {
|
|
|
|
translate(translation)
|
|
|
|
linear_extrude(dimensions[2])
|
|
|
|
square([dimensions[0], dimensions[1]], false);
|
|
|
|
}
|
2023-11-11 18:53:21 -05:00
|
|
|
|
|
|
|
module wall_corner(translation, rotation, radius, length) {
|
|
|
|
translate(translation)
|
|
|
|
rotate(rotation)
|
|
|
|
linear_extrude(length)
|
|
|
|
intersection() {
|
|
|
|
circle(r=radius);
|
|
|
|
square([radius, radius], false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-11 19:47:32 -05:00
|
|
|
module screw_post(translation, h, d1, d2) {
|
|
|
|
translate(translation)
|
|
|
|
difference() {
|
|
|
|
cylinder(h=h, r=d1/2.0);
|
|
|
|
cylinder(h=h, r=d2/2.0);
|
|
|
|
}
|
|
|
|
}
|
2023-11-11 14:21:39 -05:00
|
|
|
|
2023-11-11 15:37:03 -05:00
|
|
|
/* Upper right corner */
|
2023-11-11 20:53:22 -05:00
|
|
|
round_corner([2 * pcb_clearance_edge + pcb_width,
|
|
|
|
2 * 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 20:53:22 -05:00
|
|
|
round_corner([ 2 * pcb_clearance_edge + pcb_width,
|
|
|
|
-2 * pcb_clearance_edge, 0], [180, 90, 90]);
|
|
|
|
|
|
|
|
/* Lower left corner */
|
|
|
|
round_corner([-2 * pcb_clearance_edge,
|
|
|
|
-2 * pcb_clearance_edge, 0], [-90, 90, 90]);
|
|
|
|
|
|
|
|
/* Upper left corner */
|
|
|
|
round_corner([-2 * pcb_clearance_edge,
|
|
|
|
2 * pcb_clearance_edge + pcb_height, 0], [0, 90, 90]);
|
2023-11-11 14:21:39 -05:00
|
|
|
|
2023-11-11 18:12:21 -05:00
|
|
|
/* Upper edge */
|
2023-11-11 20:53:22 -05:00
|
|
|
round_edge([-2 * pcb_clearance_edge,
|
|
|
|
2 * pcb_clearance_edge + pcb_height, 0], [0, 90, 0],
|
|
|
|
2 * thickness + pcb_width);
|
2023-11-11 15:37:03 -05:00
|
|
|
|
2023-11-11 14:21:39 -05:00
|
|
|
/* Right edge */
|
2023-11-11 20:53:22 -05:00
|
|
|
round_edge([ 2 * pcb_clearance_edge + pcb_width,
|
|
|
|
-2 * pcb_clearance_edge, 0], [270, 0, 0],
|
|
|
|
2 * thickness + pcb_height);
|
2023-11-11 15:37:03 -05:00
|
|
|
|
2023-11-11 18:12:21 -05:00
|
|
|
/* Lower edge */
|
2023-11-11 20:53:22 -05:00
|
|
|
round_edge([-2 * pcb_clearance_edge,
|
|
|
|
-2 * pcb_clearance_edge, 0], [90, 180, 90],
|
|
|
|
2 * thickness + pcb_width);
|
2023-11-11 15:37:03 -05:00
|
|
|
|
2023-11-11 14:21:39 -05:00
|
|
|
/* Left edge */
|
2023-11-11 20:53:22 -05:00
|
|
|
round_edge([-2 * pcb_clearance_edge,
|
|
|
|
-2 * pcb_clearance_edge, 0], [270, 90, 0],
|
|
|
|
2 * thickness + pcb_height);
|
2023-11-11 14:21:39 -05:00
|
|
|
|
2023-11-11 18:53:21 -05:00
|
|
|
/* Upper right wall corner */
|
2023-11-11 20:53:22 -05:00
|
|
|
wall_corner([2 * pcb_clearance_edge + pcb_width,
|
|
|
|
2 * pcb_clearance_edge + pcb_height, 0],
|
2023-11-11 18:53:21 -05:00
|
|
|
[0, 0, 0],
|
|
|
|
corner_radius,
|
|
|
|
wall_height);
|
|
|
|
|
|
|
|
/* Lower right wall corner */
|
2023-11-11 20:53:22 -05:00
|
|
|
wall_corner([ 2 * pcb_clearance_edge + pcb_width,
|
|
|
|
-2 * pcb_clearance_edge, 0],
|
2023-11-11 18:53:21 -05:00
|
|
|
[0, 0, 270],
|
|
|
|
corner_radius,
|
|
|
|
wall_height);
|
|
|
|
|
|
|
|
/* Lower left wall corner */
|
2023-11-11 20:53:22 -05:00
|
|
|
wall_corner([-2 * pcb_clearance_edge,
|
|
|
|
-2 * pcb_clearance_edge, 0],
|
2023-11-11 18:53:21 -05:00
|
|
|
[0, 0, 180],
|
|
|
|
corner_radius,
|
|
|
|
wall_height);
|
|
|
|
|
|
|
|
/* Upper left wall corner */
|
2023-11-11 20:53:22 -05:00
|
|
|
wall_corner([-2 * pcb_clearance_edge,
|
|
|
|
2 * pcb_clearance_edge + pcb_height, 0],
|
2023-11-11 18:53:21 -05:00
|
|
|
[0, 0, 90],
|
|
|
|
corner_radius,
|
|
|
|
wall_height);
|
|
|
|
|
2023-11-11 18:12:21 -05:00
|
|
|
/* Upper wall */
|
2023-11-11 20:53:22 -05:00
|
|
|
side([-2 * pcb_clearance_edge,
|
|
|
|
pcb_clearance_edge + pcb_height, 0],
|
|
|
|
[2 * thickness + pcb_width, thickness, wall_height]);
|
2023-11-11 18:12:21 -05:00
|
|
|
|
|
|
|
/* Right wall */
|
2023-11-11 20:53:22 -05:00
|
|
|
side([ pcb_clearance_edge + pcb_width,
|
|
|
|
-2 * pcb_clearance_edge, 0],
|
|
|
|
[thickness, 2 * thickness + pcb_height, wall_height]);
|
2023-11-11 18:12:21 -05:00
|
|
|
|
|
|
|
/* Lower wall */
|
2023-11-11 20:53:22 -05:00
|
|
|
side([-2 * pcb_clearance_edge,
|
|
|
|
0 - pcb_clearance_edge - thickness, 0],
|
|
|
|
[ 2 * thickness + pcb_width, thickness, wall_height]);
|
2023-11-11 18:12:21 -05:00
|
|
|
|
|
|
|
/* Left wall */
|
2023-11-11 20:53:22 -05:00
|
|
|
side([ 0 - pcb_clearance_edge - thickness,
|
|
|
|
-2 * pcb_clearance_edge, 0],
|
|
|
|
[thickness, 2 * thickness + pcb_height, wall_height]);
|
2023-11-11 18:12:21 -05:00
|
|
|
|
|
|
|
/* Bottom plate */
|
2023-11-11 20:53:22 -05:00
|
|
|
side([-2 * pcb_clearance_edge,
|
|
|
|
-2 * pcb_clearance_edge,
|
2023-11-11 18:12:21 -05:00
|
|
|
-thickness / 2],
|
2023-11-11 20:53:22 -05:00
|
|
|
[2 * thickness + pcb_width,
|
|
|
|
2 * thickness + pcb_height,
|
2023-11-11 18:12:21 -05:00
|
|
|
thickness]);
|
2023-11-11 19:47:32 -05:00
|
|
|
|
|
|
|
/* Screw holes */
|
|
|
|
for (screw_hole = screw_holes) {
|
|
|
|
screw_post([screw_hole[0], screw_hole[1], thickness],
|
|
|
|
pcb_clearance_bottom,
|
|
|
|
pcb_screw_hole_diameter * 2,
|
|
|
|
pcb_screw_hole_diameter);
|
|
|
|
}
|
2023-11-11 14:21:39 -05:00
|
|
|
}
|
|
|
|
|
2023-11-11 19:47:32 -05:00
|
|
|
keyboard_base_plate(pcb_width, pcb_height, screw_holes);
|