My head hurts

This commit is contained in:
XANTRONIX 2023-11-15 17:56:39 -05:00
parent 4f5015ea13
commit 249c98bb23

View file

@ -33,6 +33,8 @@ module top_case(key_switch_sizes, pcb_screw_holes) {
keyboard_x_offset = 12.2500; keyboard_x_offset = 12.2500;
keyboard_y_offset = 12.2500; keyboard_y_offset = 12.2500;
keyboard_deck_z_offset = wall_height - wall_width - keyboard_switch_height;
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;
@ -78,48 +80,48 @@ module top_case(key_switch_sizes, pcb_screw_holes) {
cube([accent_depth, accent_width, wall_height], false); cube([accent_depth, accent_width, wall_height], false);
} }
} }
module support(dimensions, width) { module support(dimensions, width) {
length = dimensions[0]; length = dimensions[0];
height = dimensions[1]; height = dimensions[1];
module right_triangle(base) {
length = sqrt((base ^ 2) / 2.0);
intersection() { module right_triangle(base) {
rotate([0, 0, -45]) hypot = sqrt(2 * (base ^ 2 ));
square([length*2, length*2], true);
difference() {
square([length*2, length*2]); square([base, base], false);
translate([base, 0, 0])
rotate([0, 0, 45])
square([hypot, hypot], false);
} }
} }
module shape() { module shape() {
/* Height ratio of lower aspect to upper aspect */ /* Height ratio of lower aspect to upper aspect */
aspect_ratio = 3.75 / 12.0; aspect_ratio = 3.75 / 12.0;
aspect_upper_height = height; aspect_upper_height = height;
aspect_lower_height = aspect_ratio * height; aspect_lower_height = aspect_ratio * height;
/* The length of each individual support aspect */ /* The length of each individual support aspect */
aspect_length = 1/3 * length; aspect_length = 1/3 * length;
hypotenuse = sqrt(2*(aspect_length^2)); hypotenuse = sqrt(2*(aspect_length^2));
lower_x_offset = aspect_length - (hypotenuse - aspect_length); lower_x_offset = aspect_length - (hypotenuse - aspect_length);
right_triangle(aspect_length); right_triangle(height);
translate([lower_x_offset, 0, 0]) square([length, aspect_lower_height], false);
square([1.5 * hypotenuse, aspect_lower_height]);
translate([3 * aspect_length, 0, 0]) translate([3 * aspect_length, 0, 0])
mirror([1, 0, 0]) mirror([1, 0, 0])
right_triangle(aspect_length); right_triangle(height);
} }
linear_extrude(width) shape(); translate([0, length, 0]) rotate([-90, 0, -90]) linear_extrude(width) shape();
} }
module body() { module body() {
translate([0, 0, wall_height - wall_width]) translate([0, 0, wall_height - wall_width])
fascia(); fascia();
@ -137,6 +139,24 @@ module top_case(key_switch_sizes, pcb_screw_holes) {
/* Left */ /* Left */
cube([wall_width, case_length_bottom, wall_height - wall_width], false); cube([wall_width, case_length_bottom, wall_height - wall_width], false);
/* Upper vertical supports */
upper_support_length = case_length_bottom
- keyboard_length
- keyboard_y_offset
- 2 * wall_width;
upper_support_y_offset = keyboard_y_offset
+ keyboard_length
+ wall_width;
upper_support_x_offset = keyboard_x_offset - wall_width;
translate([upper_support_x_offset,
upper_support_y_offset,
wall_height - wall_width])
support([upper_support_length, keyboard_switch_height],
1.25);
} }
module screw_holes() { module screw_holes() {
@ -173,7 +193,7 @@ module top_case(key_switch_sizes, pcb_screw_holes) {
linear_extrude(wall_width) linear_extrude(wall_width)
difference() { difference() {
square([plate_width, plate_length], false); square([plate_width, plate_length], false);
translate([hole_x, hole_y, 0]) translate([hole_x, hole_y, 0])
square([hole_width, hole_length], false); square([hole_width, hole_length], false);
} }
@ -234,11 +254,8 @@ module top_case(key_switch_sizes, pcb_screw_holes) {
vents(); vents();
} }
keyboard_deck_z_offset = wall_height - wall_width - keyboard_switch_height;
translate([keyboard_x_offset, keyboard_y_offset, keyboard_deck_z_offset]) translate([keyboard_x_offset, keyboard_y_offset, keyboard_deck_z_offset])
keyboard_deck(); keyboard_deck();
} }
top_case(keyboard_switch_sizes, top_case(keyboard_switch_sizes, keyboard_pcb_screw_holes);
keyboard_pcb_screw_holes);