Add keyboard footprint mount

This commit is contained in:
XANTRONIX 2023-11-14 16:15:35 -05:00
parent 53e7bf5ebb
commit 83fe4ffc64

View file

@ -69,9 +69,7 @@ module top_case() {
/* Upper */
translate([0, case_length_bottom - wall_width, 0])
cube([case_width_bottom,
wall_width,
wall_height], false);
cube([case_width_bottom, wall_width, wall_height], false);
/* Right */
translate([case_width_bottom - wall_width, 0, 0])
@ -84,6 +82,63 @@ module top_case() {
cube([wall_width, case_length_bottom, wall_height - wall_width], false);
}
module keyboard_deck() {
key_switch_footprint = [16.0, 16.0];
key_switch_sizes = [
[0.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.5],
[1.25, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.25],
[1.75, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.75],
[1.0, 1.25, 1.25, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
];
function add(v) = [for(p=v) 1]*v;
function slice(v, x, y) = [for (i=[x:y]) v[i]];
function addrange(v, x, y) = add(slice(v, x, y));
module key_switch_plate(key_switch_size) {
plate_width = key_switch_width * key_switch_size;
plate_length = key_switch_length;
if (key_switch_size <= 0.5) {
cube([key_switch_width * key_switch_size,
key_switch_length,
wall_width], false);
} else {
hole_width = key_switch_footprint[0];
hole_length = key_switch_footprint[1];
hole_x = plate_width / 2 - hole_width / 2;
hole_y = plate_length / 2 - hole_length / 2;
linear_extrude(wall_width)
difference() {
square([plate_width, plate_length], false);
translate([hole_x, hole_y, 0])
square([hole_width, hole_length], false);
}
}
}
rows = len(key_switch_sizes);
for (i = [0: rows-1]) {
y = key_switch_length * (rows - 1 - i);
key_switch_row = key_switch_sizes[i];
cols = len(key_switch_row);
for (j = [0: cols-1]) {
x = key_switch_width * ((j == 0)? 0: addrange(key_switch_row, 0, j-1));
key_switch_size = key_switch_row[j];
translate([x, y, 0])
key_switch_plate(key_switch_size);
}
}
}
difference() {
body();
accents();