From 83fe4ffc64c3bdba01bbd3a293cbfee0f6a979b7 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Tue, 14 Nov 2023 16:15:35 -0500 Subject: Add keyboard footprint mount --- case/top.scad | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/case/top.scad b/case/top.scad index eeb21eb..9c3755f 100644 --- a/case/top.scad +++ b/case/top.scad @@ -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(); -- cgit v1.2.3