diff options
-rw-r--r-- | case/top.scad | 71 |
1 files changed, 44 insertions, 27 deletions
diff --git a/case/top.scad b/case/top.scad index 0279fd7..4454ba2 100644 --- a/case/top.scad +++ b/case/top.scad @@ -33,6 +33,8 @@ module top_case(key_switch_sizes, pcb_screw_holes) { keyboard_x_offset = 12.2500; keyboard_y_offset = 12.2500; + keyboard_deck_z_offset = wall_height - wall_width - keyboard_switch_height; + accent_width = 1.0000; accent_depth = 0.5; 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); } } - - module support(dimensions, width) { + + module support(dimensions, width) { length = dimensions[0]; height = dimensions[1]; - + module right_triangle(base) { - length = sqrt((base ^ 2) / 2.0); + hypot = sqrt(2 * (base ^ 2 )); + + difference() { + square([base, base], false); - intersection() { - rotate([0, 0, -45]) - square([length*2, length*2], true); - - square([length*2, length*2]); + translate([base, 0, 0]) + rotate([0, 0, 45]) + square([hypot, hypot], false); } } - + module shape() { /* Height ratio of lower aspect to upper aspect */ aspect_ratio = 3.75 / 12.0; - + 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(aspect_length); - - translate([lower_x_offset, 0, 0]) - square([1.5 * hypotenuse, aspect_lower_height]); - + + right_triangle(height); + + square([length, aspect_lower_height], false); + translate([3 * aspect_length, 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() { translate([0, 0, wall_height - wall_width]) fascia(); @@ -137,6 +139,24 @@ module top_case(key_switch_sizes, pcb_screw_holes) { /* Left */ 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() { @@ -173,7 +193,7 @@ module top_case(key_switch_sizes, pcb_screw_holes) { linear_extrude(wall_width) difference() { square([plate_width, plate_length], false); - + translate([hole_x, hole_y, 0]) square([hole_width, hole_length], false); } @@ -234,11 +254,8 @@ module top_case(key_switch_sizes, pcb_screw_holes) { vents(); } - keyboard_deck_z_offset = wall_height - wall_width - keyboard_switch_height; - translate([keyboard_x_offset, keyboard_y_offset, keyboard_deck_z_offset]) keyboard_deck(); } -top_case(keyboard_switch_sizes, - keyboard_pcb_screw_holes); +top_case(keyboard_switch_sizes, keyboard_pcb_screw_holes); |