From 6b048e9827842695d0fca7e366251afbf40018b9 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Tue, 14 Nov 2023 16:29:51 -0500 Subject: Got screw holes lined up just about! --- case/top.scad | 76 +++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 20 deletions(-) (limited to 'case') diff --git a/case/top.scad b/case/top.scad index 9c3755f..62ea948 100644 --- a/case/top.scad +++ b/case/top.scad @@ -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,21 +144,32 @@ module top_case() { } } - rows = len(key_switch_sizes); + 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 (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)); - 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]; + key_switch_size = key_switch_row[j]; - translate([x, y, 0]) - key_switch_plate(key_switch_size); + translate([x, y, 0]) + key_switch_plate(key_switch_size); + } } } + + difference() { + body(); + screw_holes(); + } } difference() { @@ -144,6 +177,9 @@ module top_case() { accents(); fin_gaps(); } + + translate([0, 0, 20]) + keyboard_deck(); } -top_case(); +top_case(key_switch_sizes, pcb_screw_holes); -- cgit v1.2.3