232 lines
6.9 KiB
OpenSCAD
232 lines
6.9 KiB
OpenSCAD
$fn = 72;
|
|
|
|
pcb_width = 257.175;
|
|
pcb_length = 95.250;
|
|
|
|
module keyboard_base_plate(pcb_width, pcb_length) {
|
|
pcb_clearance_edge = 1.0;
|
|
pcb_clearance_bottom = 2.0;
|
|
|
|
pcb_screw_hole_diameter = 1.5;
|
|
|
|
thickness = 1.75;
|
|
wall_height = 14.0;
|
|
corner_radius = thickness / 2.0;
|
|
|
|
case_color = [0.5, 0.5, 0.5, 1.0];
|
|
|
|
bottom_width = 2 * (pcb_clearance_edge + thickness) + pcb_width;
|
|
bottom_length = 2 * (pcb_clearance_edge + thickness) + pcb_length;
|
|
|
|
screw_holes = [
|
|
[ 4.8150, 85.7250],
|
|
[ 66.7322, 85.7250],
|
|
[161.8150, 85.7250],
|
|
[238.2500, 85.7250],
|
|
[ 61.7500, 47.6250],
|
|
[138.2500, 47.6250],
|
|
[214.2500, 47.6250],
|
|
[ 20.0000, 9.5250],
|
|
[123.8150, 9.5250],
|
|
[238.2500, 9.5250]
|
|
];
|
|
|
|
module round_corner(translation, rotation) {
|
|
color(case_color)
|
|
translate(translation)
|
|
rotate(rotation)
|
|
rotate_extrude(angle=90) {
|
|
intersection() {
|
|
circle(r=corner_radius);
|
|
square(corner_radius*2);
|
|
}
|
|
}
|
|
}
|
|
|
|
module round_edge(translation, rotation, length) {
|
|
color(case_color)
|
|
translate(translation)
|
|
rotate(rotation)
|
|
linear_extrude(length)
|
|
intersection() {
|
|
circle(r=corner_radius);
|
|
square(corner_radius*2);
|
|
}
|
|
}
|
|
|
|
module side(translation, dimensions) {
|
|
color(case_color)
|
|
translate(translation)
|
|
linear_extrude(dimensions[2])
|
|
square([dimensions[0], dimensions[1]], false);
|
|
}
|
|
|
|
module wall_corner(translation, rotation, radius, length) {
|
|
color(case_color)
|
|
translate(translation)
|
|
rotate(rotation)
|
|
linear_extrude(length)
|
|
intersection() {
|
|
circle(r=radius);
|
|
square([radius, radius], false);
|
|
}
|
|
}
|
|
|
|
module screw_post(translation, h, d1, d2) {
|
|
color(case_color)
|
|
translate(translation)
|
|
difference() {
|
|
cylinder(h=h, r=d1/2.0);
|
|
cylinder(h=h, r=d2/2.0);
|
|
}
|
|
}
|
|
|
|
module ridges() {
|
|
horizontal = [
|
|
(bottom_length / 3),
|
|
(bottom_length / 3) * 2
|
|
];
|
|
|
|
vertical = [
|
|
(bottom_width / 4),
|
|
(bottom_width / 4) * 2,
|
|
(bottom_width / 4) * 3
|
|
];
|
|
|
|
for (y = horizontal) {
|
|
side([0 - pcb_clearance_edge, y, 0],
|
|
[pcb_width, thickness * 2, pcb_clearance_edge]);
|
|
}
|
|
|
|
for (x = vertical) {
|
|
side([x, 0 - pcb_clearance_edge, 0],
|
|
[thickness * 2, pcb_length, pcb_clearance_edge]);
|
|
}
|
|
}
|
|
|
|
/* Upper right corner */
|
|
round_corner([thickness + pcb_clearance_edge + pcb_width,
|
|
thickness + pcb_clearance_edge + pcb_length,
|
|
-thickness/2],
|
|
[90, 90, 90]);
|
|
|
|
/* Lower right corner */
|
|
round_corner([ thickness + pcb_clearance_edge + pcb_width,
|
|
0 - thickness - pcb_clearance_edge,
|
|
-thickness/2],
|
|
[180, 90, 90]);
|
|
|
|
/* Lower left corner */
|
|
round_corner([0 - thickness - pcb_clearance_edge,
|
|
0 - thickness - pcb_clearance_edge,
|
|
-thickness/2],
|
|
[-90, 90, 90]);
|
|
|
|
/* Upper left corner */
|
|
round_corner([0 - thickness - pcb_clearance_edge,
|
|
thickness + pcb_clearance_edge + pcb_length,
|
|
-thickness/2],
|
|
[0, 90, 90]);
|
|
|
|
/* Upper edge */
|
|
round_edge([0 - thickness - pcb_clearance_edge,
|
|
thickness + pcb_clearance_edge + pcb_length,
|
|
-thickness/2],
|
|
[0, 90, 0],
|
|
bottom_width);
|
|
|
|
/* Right edge */
|
|
round_edge([ thickness + pcb_clearance_edge + pcb_width,
|
|
0 - thickness - pcb_clearance_edge,
|
|
-thickness/2],
|
|
[270, 0, 0],
|
|
bottom_length);
|
|
|
|
/* Lower edge */
|
|
round_edge([0 - thickness - pcb_clearance_edge,
|
|
0 - thickness - pcb_clearance_edge,
|
|
-thickness/2],
|
|
[90, 180, 90],
|
|
bottom_width);
|
|
|
|
/* Left edge */
|
|
round_edge([0 - thickness - pcb_clearance_edge,
|
|
0 - thickness - pcb_clearance_edge,
|
|
-thickness/2],
|
|
[270, 90, 0],
|
|
bottom_length);
|
|
|
|
/* Upper right wall corner */
|
|
wall_corner([thickness + pcb_clearance_edge + pcb_width,
|
|
thickness + pcb_clearance_edge + pcb_length,
|
|
-thickness/2],
|
|
[0, 0, 0],
|
|
corner_radius,
|
|
wall_height);
|
|
|
|
/* Lower right wall corner */
|
|
wall_corner([ thickness + pcb_clearance_edge + pcb_width,
|
|
0 - thickness - pcb_clearance_edge,
|
|
-thickness/2],
|
|
[0, 0, 270],
|
|
corner_radius,
|
|
wall_height);
|
|
|
|
/* Lower left wall corner */
|
|
wall_corner([0 - thickness - pcb_clearance_edge,
|
|
0 - thickness - pcb_clearance_edge,
|
|
-thickness/2],
|
|
[0, 0, 180],
|
|
corner_radius,
|
|
wall_height);
|
|
|
|
/* Upper left wall corner */
|
|
wall_corner([0 - thickness - pcb_clearance_edge,
|
|
thickness + pcb_clearance_edge + pcb_length,
|
|
-thickness/2],
|
|
[0, 0, 90],
|
|
corner_radius,
|
|
wall_height);
|
|
|
|
/* Upper wall */
|
|
side([0 - thickness - pcb_clearance_edge,
|
|
pcb_clearance_edge + pcb_length + corner_radius,
|
|
-thickness/2],
|
|
[bottom_width, thickness, wall_height]);
|
|
|
|
/* Right wall */
|
|
side([pcb_clearance_edge + pcb_width + corner_radius,
|
|
0 - thickness - pcb_clearance_edge,
|
|
-thickness/2],
|
|
[thickness, bottom_length, wall_height]);
|
|
|
|
/* Lower wall */
|
|
side([0 - thickness - pcb_clearance_edge,
|
|
0 - thickness - pcb_clearance_edge - corner_radius,
|
|
-thickness/2],
|
|
[bottom_width, thickness, wall_height]);
|
|
|
|
/* Left wall */
|
|
side([0 - thickness - pcb_clearance_edge - corner_radius,
|
|
0 - thickness - pcb_clearance_edge,
|
|
-thickness/2],
|
|
[thickness, bottom_length, wall_height]);
|
|
|
|
/* Bottom plate */
|
|
side([0 - thickness - pcb_clearance_edge,
|
|
0 - thickness - pcb_clearance_edge,
|
|
0 - thickness],
|
|
[bottom_width, bottom_length, thickness]);
|
|
|
|
/* Screw holes */
|
|
for (screw_hole = screw_holes) {
|
|
screw_post([screw_hole[0], screw_hole[1], 0],
|
|
pcb_clearance_bottom * 2,
|
|
pcb_screw_hole_diameter * 2,
|
|
pcb_screw_hole_diameter);
|
|
}
|
|
|
|
ridges();
|
|
}
|
|
|
|
keyboard_base_plate(pcb_width, pcb_length);
|