Little a refactor, as a treat

This commit is contained in:
XANTRONIX 2023-11-14 12:46:52 -05:00
parent 423c1f5408
commit 53e7bf5ebb

View file

@ -1,52 +1,53 @@
$fn = 72; $fn = 72;
case_width_top = 317.5000; module top_case() {
case_width_bottom = 320.0000; case_width_top = 317.5000;
case_length_top = 150.0000; case_width_bottom = 320.0000;
case_length_bottom = 151.5000; case_length_top = 150.0000;
case_length_bottom = 151.5000;
wall_width = 2.5000; wall_width = 2.5000;
wall_height = 17.2500; wall_height = 17.2500;
key_switch_width = 19.0500; key_switch_width = 19.0500;
key_switch_length = 19.0500; key_switch_length = 19.0500;
keyboard_width = key_switch_width * 13.5; keyboard_width = key_switch_width * 13.5;
keyboard_length = key_switch_length * 5.0; keyboard_length = key_switch_length * 5.0;
keyboard_x_offset = 12.2500; keyboard_x_offset = 12.2500;
keyboard_y_offset = 12.2500; keyboard_y_offset = 12.2500;
accent_width = 1.0000; accent_width = 1.0000;
accent_depth = 0.5; accent_depth = 0.5;
accent_y_stride = (keyboard_length - accent_width) / 5.0; accent_y_stride = (keyboard_length - accent_width) / 5.0;
accent_y_bottom = keyboard_y_offset; accent_y_bottom = keyboard_y_offset;
fin_width = 2.0000; fin_width = 2.0000;
fin_gap_width = 2.0000; fin_gap_width = 2.0000;
fin_gap_length = 2.0000; fin_gap_length = 2.0000;
fin_gap_height = 12.0000; fin_gap_height = 12.0000;
fin_gap_count = 32; fin_gap_count = 32;
fin_gap_x_first = keyboard_x_offset + keyboard_width - fin_gap_count * (fin_width + fin_gap_width); fin_gap_x_first = keyboard_x_offset + keyboard_width - fin_gap_count * (fin_width + fin_gap_width);
fin_gap_y_offset = case_length_bottom - fin_gap_length; fin_gap_y_offset = case_length_bottom - fin_gap_length;
module fascia() { module fascia() {
linear_extrude(wall_width) linear_extrude(wall_width)
difference() { difference() {
square([case_width_bottom, case_length_bottom], false); square([case_width_bottom, case_length_bottom], false);
translate([keyboard_x_offset, keyboard_y_offset, 0]) translate([keyboard_x_offset, keyboard_y_offset, 0])
square([keyboard_width, keyboard_length], false); square([keyboard_width, keyboard_length], false);
} }
} }
module fin_gaps() { module fin_gaps() {
for (i = [0:fin_gap_count]) { for (i = [0:fin_gap_count]) {
x = fin_gap_x_first + (i * (fin_width + fin_gap_width)); x = fin_gap_x_first + (i * (fin_width + fin_gap_width));
translate([x, fin_gap_y_offset, wall_height - fin_gap_height]) translate([x, fin_gap_y_offset, wall_height - fin_gap_height])
cube([fin_gap_width, fin_gap_length, fin_gap_height], false); cube([fin_gap_width, fin_gap_length, fin_gap_height], false);
} }
} }
module accents() { module accents() {
for (y = [accent_y_bottom: accent_y_stride: case_length_bottom]) { for (y = [accent_y_bottom: accent_y_stride: case_length_bottom]) {
/* Top */ /* Top */
translate([0, y, wall_height - accent_depth]) translate([0, y, wall_height - accent_depth])
@ -60,9 +61,9 @@ module accents() {
translate([0, y, 0]) translate([0, y, 0])
cube([accent_depth, accent_width, wall_height], false); cube([accent_depth, accent_width, wall_height], false);
} }
} }
module top_case() { module body() {
translate([0, 0, wall_height - wall_width]) translate([0, 0, wall_height - wall_width])
fascia(); fascia();
@ -81,10 +82,13 @@ module top_case() {
/* Left */ /* Left */
cube([wall_width, case_length_bottom, wall_height - wall_width], false); cube([wall_width, case_length_bottom, wall_height - wall_width], false);
} }
difference() { difference() {
top_case(); body();
accents(); accents();
fin_gaps(); fin_gaps();
}
} }
top_case();