diff options
author | XANTRONIX Development | 2023-11-16 20:16:24 -0500 |
---|---|---|
committer | XANTRONIX Development | 2023-11-16 20:16:24 -0500 |
commit | d2c614543719a065fa1f4d19b30f860565e85ba5 (patch) | |
tree | 5acdedaf333fa261f55237b9fbaf7982115cba13 | |
parent | 62855b75dcf995b3bf577df9cc928ec7bde419ec (diff) | |
download | xantronix-z32-d2c614543719a065fa1f4d19b30f860565e85ba5.tar.gz xantronix-z32-d2c614543719a065fa1f4d19b30f860565e85ba5.tar.bz2 xantronix-z32-d2c614543719a065fa1f4d19b30f860565e85ba5.zip |
The dogs of war
-rw-r--r-- | case/keyboard.scad | 90 | ||||
-rw-r--r-- | case/top.scad | 114 |
2 files changed, 102 insertions, 102 deletions
diff --git a/case/keyboard.scad b/case/keyboard.scad index 06ff2d2..0c4f14e 100644 --- a/case/keyboard.scad +++ b/case/keyboard.scad @@ -26,3 +26,93 @@ keyboard_pcb_screw_holes = [ [123.8250, 9.5250], [238.1250, 9.5250] ]; + +module keyboard_deck(wall_width) { + key_switch_footprint = [15.25, 15.25]; + + eps = 0.01; + + 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 screw_holes() { + pcb_screw_diameter = 2.5; + + for (screw_hole = keyboard_pcb_screw_holes) { + translate([screw_hole[0], screw_hole[1], -eps]) + cylinder(h=wall_width+2*eps, d=pcb_screw_diameter); + } + } + + module key_switch_plate(key_switch_size) { + plate_width = keyboard_switch_width * key_switch_size; + plate_length = keyboard_switch_length; + + if (key_switch_size <= 0.5) { + cube([keyboard_switch_width * key_switch_size, + keyboard_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; + + difference() { + cube([plate_width + eps, plate_length + eps, wall_width], false); + + translate([hole_x, hole_y, -eps]) + cube([hole_width, hole_length, wall_width + 2*eps], false); + } + } + } + + module walls() { + /* Upper */ + translate([-wall_width, keyboard_pcb_length, 0]) + cube([keyboard_pcb_width + 2 * wall_width, wall_width, keyboard_switch_height], false); + + /* Right */ + translate([keyboard_pcb_width, -wall_width, 0]) + cube([wall_width, keyboard_pcb_length + 2 * wall_width, keyboard_switch_height], false); + + /* Lower */ + translate([-wall_width, -wall_width, 0]) + cube([keyboard_pcb_width + 2 * wall_width, wall_width, keyboard_switch_height], false); + + /* Left */ + translate([-wall_width, -wall_width, 0]) + cube([wall_width, keyboard_pcb_length + 2 * wall_width, keyboard_switch_height], false); + } + + module body() { + rows = len(keyboard_switch_sizes); + + for (i = [0: rows-1]) { + y = keyboard_switch_length * (rows - 1 - i); + + key_switch_row = keyboard_switch_sizes[i]; + cols = len(key_switch_row); + + for (j = [0: cols-1]) { + x = keyboard_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(); + screw_holes(); + } + + walls(); +} diff --git a/case/top.scad b/case/top.scad index fe741bb..c304127 100644 --- a/case/top.scad +++ b/case/top.scad @@ -11,8 +11,6 @@ module top_case(key_switch_sizes, pcb_screw_holes) { wall_width = 2.5000; wall_height = 17.2500; - keyboard_width = keyboard_switch_width * 13.5; - keyboard_length = keyboard_switch_length * 5.0; keyboard_x_offset = 12.2500; keyboard_y_offset = 12.2500; @@ -20,14 +18,14 @@ module top_case(key_switch_sizes, pcb_screw_holes) { accent_width = 1.0000; accent_depth = 0.5; - accent_y_stride = (keyboard_length - accent_width) / 5.0; + accent_y_stride = (keyboard_pcb_length - accent_width) / 5.0; accent_y_bottom = keyboard_y_offset; vent_width = 2.0000; vent_length = wall_width; vent_height = 12.0000; vent_count = 32; - vent_x_first = keyboard_x_offset + keyboard_width - vent_count * (vent_width + vent_width); + vent_x_first = keyboard_x_offset + keyboard_pcb_width - vent_count * (vent_width + vent_width); vent_y_offset = case_length_bottom - vent_length; support_width = 1.2500; @@ -48,7 +46,7 @@ module top_case(key_switch_sizes, pcb_screw_holes) { cube([case_width_bottom, case_length_bottom, wall_width], false); translate([keyboard_x_offset, keyboard_y_offset, -eps]) - cube([keyboard_width, keyboard_length, wall_width + 2*eps], false); + cube([keyboard_pcb_width, keyboard_pcb_length, wall_width + 2*eps], false); } } @@ -160,20 +158,20 @@ module top_case(key_switch_sizes, pcb_screw_holes) { } } - support_x_interval = (keyboard_width + 2 * wall_width - support_width) / 6; + support_x_interval = (keyboard_pcb_width + 2 * wall_width - support_width) / 6; support_x_offset = keyboard_x_offset - wall_width; - support_y_interval = (keyboard_length + 2 * wall_width - support_width) / 4; + support_y_interval = (keyboard_pcb_length + 2 * wall_width - support_width) / 4; support_y_offset = keyboard_y_offset; /* Upper vertical supports */ upper_support_length = case_length_bottom - - keyboard_length + - keyboard_pcb_length - keyboard_y_offset - 2 * wall_width; upper_support_y_offset = keyboard_y_offset - + keyboard_length + + keyboard_pcb_length + wall_width; /* Lower vertical supports */ @@ -186,15 +184,15 @@ module top_case(key_switch_sizes, pcb_screw_holes) { /* Right horizontal supports */ right_support_length = case_width_bottom - - keyboard_width + - keyboard_pcb_width - keyboard_x_offset - 2 * wall_width; right_support_x_offset = keyboard_x_offset - + keyboard_width + + keyboard_pcb_width + wall_width; - for (x = [0: support_x_interval: keyboard_width + 2 * wall_width]) { + for (x = [0: support_x_interval: keyboard_pcb_width + 2 * wall_width]) { translate([support_x_offset + x, upper_support_y_offset - eps, wall_height - wall_width]) @@ -206,7 +204,7 @@ module top_case(key_switch_sizes, pcb_screw_holes) { support([lower_support_length + 2*eps, keyboard_switch_height], support_width); } - for (y = [0: support_y_interval: keyboard_length + 2 * wall_width]) { + for (y = [0: support_y_interval: keyboard_pcb_length + 2 * wall_width]) { translate([right_support_x_offset - eps, support_y_offset + y - wall_width + support_width, wall_height - wall_width]) @@ -240,94 +238,6 @@ module top_case(key_switch_sizes, pcb_screw_holes) { cube([wall_width, case_length_bottom, wall_height], false); } - module keyboard_deck() { - key_switch_footprint = [15.25, 15.25]; - - 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 screw_holes() { - pcb_screw_diameter = 2.5; - - for (screw_hole = pcb_screw_holes) { - translate([screw_hole[0], screw_hole[1], -eps]) - cylinder(h=wall_width+2*eps, d=pcb_screw_diameter); - } - } - - module key_switch_plate(key_switch_size) { - plate_width = keyboard_switch_width * key_switch_size; - plate_length = keyboard_switch_length; - - if (key_switch_size <= 0.5) { - cube([keyboard_switch_width * key_switch_size, - keyboard_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; - - difference() { - cube([plate_width + eps, plate_length + eps, wall_width], false); - - translate([hole_x, hole_y, -eps]) - cube([hole_width, hole_length, wall_width + 2*eps], false); - } - } - } - - module walls() { - /* Upper */ - translate([-wall_width, keyboard_length, 0]) - cube([keyboard_width + 2 * wall_width, wall_width, keyboard_switch_height], false); - - /* Right */ - translate([keyboard_width, -wall_width, 0]) - cube([wall_width, keyboard_length + 2 * wall_width, keyboard_switch_height], false); - - /* Lower */ - translate([-wall_width, -wall_width, 0]) - cube([keyboard_width + 2 * wall_width, wall_width, keyboard_switch_height], false); - - /* Left */ - translate([-wall_width, -wall_width, 0]) - cube([wall_width, keyboard_length + 2 * wall_width, keyboard_switch_height], false); - } - - module body() { - rows = len(key_switch_sizes); - - for (i = [0: rows-1]) { - y = keyboard_switch_length * (rows - 1 - i); - - key_switch_row = key_switch_sizes[i]; - cols = len(key_switch_row); - - for (j = [0: cols-1]) { - x = keyboard_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(); - screw_holes(); - } - - walls(); - } - difference() { body(); accents(); @@ -338,7 +248,7 @@ module top_case(key_switch_sizes, pcb_screw_holes) { screw_posts(); translate([keyboard_x_offset, keyboard_y_offset, keyboard_deck_z_offset]) - keyboard_deck(); + keyboard_deck(wall_width); } top_case(keyboard_switch_sizes, keyboard_pcb_screw_holes); |