Got screw holes lined up just about!

This commit is contained in:
XANTRONIX 2023-11-14 16:29:51 -05:00
parent 83fe4ffc64
commit 6b048e9827

View file

@ -1,6 +1,27 @@
$fn = 72;
module top_case() {
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]
];
pcb_screw_holes = [
[ 4.7625, 85.7250],
[ 66.6750, 85.7250],
[161.9250, 85.7250],
[238.1250, 85.7250],
[ 61.9125, 47.6250],
[138.1125, 47.6250],
[214.3125, 47.6250],
[ 19.0500, 9.5250],
[123.8250, 9.5250],
[238.1250, 9.5250]
];
module top_case(key_switch_sizes, pcb_screw_holes) {
case_width_top = 317.5000;
case_width_bottom = 320.0000;
case_length_top = 150.0000;
@ -82,17 +103,18 @@ module top_case() {
cube([wall_width, case_length_bottom, wall_height - wall_width], false);
}
module screw_holes() {
pcb_screw_diameter = 1.5;
for (screw_hole = pcb_screw_holes) {
translate([screw_hole[0], screw_hole[1], 0])
cylinder(h=wall_width, d=pcb_screw_diameter);
}
}
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));
@ -122,15 +144,20 @@ module top_case() {
}
}
module body() {
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));
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])
@ -141,9 +168,18 @@ module top_case() {
difference() {
body();
accents();
fin_gaps();
screw_holes();
}
}
top_case();
difference() {
body();
accents();
fin_gaps();
}
translate([0, 0, 20])
keyboard_deck();
}
top_case(key_switch_sizes, pcb_screw_holes);