From a25823d06af9590a14d6891b1f92297183b3b767 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Mon, 20 Nov 2023 00:50:27 -0500 Subject: Move support module to case/support.scad --- case/support.scad | 46 ++++++++++++++++++++++++++++++++++++++++++++++ case/top.scad | 48 ++---------------------------------------------- 2 files changed, 48 insertions(+), 46 deletions(-) create mode 100644 case/support.scad diff --git a/case/support.scad b/case/support.scad new file mode 100644 index 0000000..6aa8a84 --- /dev/null +++ b/case/support.scad @@ -0,0 +1,46 @@ +module support(dimensions, width) { + aspect_ratio = 3.75 / 12.0; + + length = dimensions[0]; + height = dimensions[1]; + + module right_triangle(base) { + hypot = sqrt(2*(base^2)); + + intersection() { + square([base, base]); + + translate([-base, 0, 0]) + rotate([0, 0, -45]) + square([hypot, hypot]); + } + } + + module shape() { + /* Height ratio of lower aspect to upper aspect */ + aspect_upper_height = height; + aspect_lower_height = aspect_ratio * height; + + /* The length of each individual support aspect */ + aspect_length = 1/3 * length; + + hypotenuse = sqrt(2*(aspect_length^2)); + lower_x_offset = aspect_length - (hypotenuse - aspect_length); + + right_triangle(height); + + square([length, aspect_lower_height], false); + + translate([3 * aspect_length, 0, 0]) + mirror([1, 0, 0]) + right_triangle(height); + } + + translate([0, length, 0]) + rotate([-90, 0, -90]) + linear_extrude(width) + intersection() { + shape(); + square([length, height], false); + } +} diff --git a/case/top.scad b/case/top.scad index ce89eca..3aabfb8 100644 --- a/case/top.scad +++ b/case/top.scad @@ -1,7 +1,8 @@ $fn = 72; -include include +include +include module top_case() { keyboard_deck_z_offset = wall_height - keyboard_switch_height; @@ -74,51 +75,6 @@ module top_case() { support_height = keyboard_switch_height - wall_width; aspect_ratio = 3.75 / 12.0; - module support(dimensions, width) { - length = dimensions[0]; - height = dimensions[1]; - - module right_triangle(base) { - hypot = sqrt(2*(base^2)); - - intersection() { - square([base, base]); - - translate([-base, 0, 0]) - rotate([0, 0, -45]) - square([hypot, hypot]); - } - } - - module shape() { - /* Height ratio of lower aspect to upper aspect */ - aspect_upper_height = height; - aspect_lower_height = aspect_ratio * height; - - /* The length of each individual support aspect */ - aspect_length = 1/3 * length; - - hypotenuse = sqrt(2*(aspect_length^2)); - lower_x_offset = aspect_length - (hypotenuse - aspect_length); - - right_triangle(height); - - square([length, aspect_lower_height], false); - - translate([3 * aspect_length, 0, 0]) - mirror([1, 0, 0]) - right_triangle(height); - } - - translate([0, length, 0]) - rotate([-90, 0, -90]) - linear_extrude(width) - intersection() { - shape(); - square([length, height], false); - } - } - support_x_interval = (keyboard_pcb_width + 2 * wall_width - support_width) / 6; support_x_offset = keyboard_x_offset - wall_width; -- cgit v1.2.3