Files
keyboard_scad/backplate_numpad.scad
2026-02-22 11:33:39 +01:00

82 lines
2.9 KiB
OpenSCAD

// --- Parameters ---
columns = 4;
rows = 6;
u_size = 19.05;
switch_outer_width = 14.2;
switch_inner_width = 13.2;
switch_total_height = 14.2;
notch_height = 4.0;
plate_thickness = 1.5;
margin = 5.0;
// --- Calculated Plate Dimensions ---
plate_width = (columns - 1) * u_size + switch_outer_width + (margin * 2);
plate_height = (rows - 1) * u_size + switch_total_height + (margin * 2);
// --- Modules ---
module switch_cutout() {
union() {
cube([switch_inner_width, switch_total_height, plate_thickness + 2], center=true);
translate([0, (switch_total_height - (switch_total_height-notch_height)/2)/2, 0])
cube([switch_outer_width, (switch_total_height-notch_height)/2, plate_thickness + 2], center=true);
translate([0, -(switch_total_height - (switch_total_height-notch_height)/2)/2, 0])
cube([switch_outer_width, (switch_total_height-notch_height)/2, plate_thickness + 2], center=true);
}
}
module stabilizer_cutout(is_vertical=false) {
dist = 23.85; // Standard 2u stabilizer distance
union() {
switch_cutout();
rotate([0, 0, is_vertical ? 90 : 0]) {
for(m = [-1, 1]) {
translate([m * dist/2, 0, 0]) {
cube([3.3, 14.0, plate_thickness + 2], center=true);
translate([m * 0.5, 0, 0])
cube([4.3, 8.0, plate_thickness + 2], center=true);
}
}
}
}
}
module whole_plate() {
difference() {
cube([plate_width, plate_height, plate_thickness]);
translate([margin + switch_outer_width/2, margin + switch_total_height/2, plate_thickness/2]) {
for (r = [0 : rows - 1]) {
for (c = [0 : columns - 1]) {
translate([c * u_size, r * u_size, 0]) {
// 1. COLUMN 3: (Enter, Plus, and 2 1U Keys)
if (c == 3) {
if (r == 0 || r == 2) {
// Bottom 2 2U Vertical keys
translate([0, u_size/2, 0]) stabilizer_cutout(true);
} else if (r == 4 || r == 5) {
// Top 2 1U keys
switch_cutout();
}
}
// 2. BOTTOM ROW: 2U '0' Key (Cols 0 and 1)
else if (r == 0 && (c == 0 || c == 1)) {
if (c == 0) translate([u_size/2, 0, 0]) stabilizer_cutout(false);
}
// 3. OTHER 1U KEYS
else {
switch_cutout();
}
}
}
}
}
}
}
// --- full render ---
whole_plate();