From 6b03e550bae8866325474f0e69c6ccc278d32d27 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Thu, 16 Nov 2023 13:51:20 -0500 Subject: 2-manifold my ass --- case/top.scad | 93 +++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 61 insertions(+), 32 deletions(-) diff --git a/case/top.scad b/case/top.scad index 1e4aa45..9609e2b 100644 --- a/case/top.scad +++ b/case/top.scad @@ -32,19 +32,23 @@ module top_case(key_switch_sizes, pcb_screw_holes) { support_width = 1.2500; - screw_post_diameter_inner = 3.00; - screw_post_diameter_outer = 6.25; - screw_post_corner_height = 12.00; - screw_post_middle_height = 29.30; - screw_post_upper_y_offset = case_length_bottom - wall_width - 15.00; - screw_post_x_offset = wall_width + 6.50; + screw_post_diameter_inner = 3.00; + screw_post_diameter_outer = 6.25; + screw_post_corner_height = 12.00; + screw_post_middle_height = 29.30; + screw_post_upper_y_offset = case_length_bottom - wall_width - 15.00; + screw_post_middle_y_offset = 72.50; + screw_post_lower_y_offset = 6.50; + screw_post_x_offset = (keyboard_x_offset - 2 * wall_width) / 2 + wall_width; + + eps = 0.01; module fascia() { - linear_extrude(wall_width) difference() { - square([case_width_bottom, case_length_bottom], false); - translate([keyboard_x_offset, keyboard_y_offset, 0]) - square([keyboard_width, keyboard_length], false); + 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); } } @@ -52,24 +56,24 @@ module top_case(key_switch_sizes, pcb_screw_holes) { for (i = [0:vent_count]) { x = vent_x_first + (i * (vent_width + vent_width)); - translate([x, vent_y_offset, wall_height - vent_height]) - cube([vent_width, vent_length, vent_height], false); + translate([x, vent_y_offset-eps, wall_height - vent_height]) + cube([vent_width, vent_length+2*eps, vent_height+eps], false); } } module accents() { for (y = [accent_y_bottom: accent_y_stride: case_length_bottom]) { /* Top */ - translate([0, y, wall_height - accent_depth]) - cube([case_width_bottom, accent_width, accent_depth], false); + translate([-eps, y, wall_height - accent_depth]) + cube([case_width_bottom+2*eps, accent_width, accent_depth+eps], false); /* Right */ - translate([case_width_bottom - accent_depth, y, 0]) - cube([accent_depth, accent_width, wall_height], false); + translate([case_width_bottom - accent_depth, y, -eps]) + cube([accent_depth+eps, accent_width+eps, wall_height+2*eps], false); /* Left */ - translate([0, y, 0]) - cube([accent_depth, accent_width, wall_height], false); + translate([-eps, y, -eps]) + cube([accent_depth+eps, accent_width, wall_height+2*eps], false); } } @@ -78,8 +82,33 @@ module top_case(key_switch_sizes, pcb_screw_holes) { diameter_outer = 6.25; difference() { - cylinder(h, d=diameter_inner); cylinder(h, d=diameter_outer); + + translate([0, 0, -eps]) + cylinder(h + 2*eps, d=diameter_inner); + } + } + + module screw_posts() { + posts = [ + /* Upper row */ + [screw_post_x_offset, screw_post_upper_y_offset, screw_post_corner_height], + [case_width_bottom / 2, screw_post_upper_y_offset, screw_post_middle_height], + [case_width_bottom - screw_post_x_offset, screw_post_upper_y_offset, screw_post_corner_height], + + /* Middle row */ + [screw_post_x_offset, screw_post_middle_y_offset, screw_post_corner_height], + [case_width_bottom - screw_post_x_offset, screw_post_middle_y_offset, screw_post_corner_height], + + /* Bottom row */ + [screw_post_x_offset, screw_post_lower_y_offset, screw_post_corner_height], + [case_width_bottom / 2, screw_post_lower_y_offset, screw_post_corner_height], + [case_width_bottom - screw_post_x_offset, screw_post_lower_y_offset, screw_post_corner_height] + ]; + + for (post = posts) { + translate([post[0], post[1], wall_height - wall_width - post[2]]) + screw_post(post[2]); } } @@ -88,14 +117,14 @@ module top_case(key_switch_sizes, pcb_screw_holes) { height = dimensions[1]; module right_triangle(base) { - hypot = sqrt(2 * (base ^ 2 )); + hypot = sqrt(2*(base^2)); - difference() { - square([base, base], false); + intersection() { + square([base, base]); - translate([base, 0, 0]) - rotate([0, 0, 45]) - square([hypot, hypot], false); + translate([-base, 0, 0]) + rotate([0, 0, -45]) + square([hypot, hypot]); } } @@ -188,7 +217,7 @@ module top_case(key_switch_sizes, pcb_screw_holes) { support_y_offset + y - wall_width + support_width, wall_height - wall_width]) rotate([0, 0, -90]) - support([left_support_length + 0.0001, keyboard_switch_height], support_width); + support([left_support_length, keyboard_switch_height], support_width); } } @@ -215,8 +244,8 @@ module top_case(key_switch_sizes, pcb_screw_holes) { pcb_screw_diameter = 2.5; for (screw_hole = pcb_screw_holes) { - translate([screw_hole[0], screw_hole[1], 0]) - cylinder(h=wall_width, d=pcb_screw_diameter); + translate([screw_hole[0], screw_hole[1], -eps]) + cylinder(h=wall_width+2*eps, d=pcb_screw_diameter); } } @@ -242,12 +271,11 @@ module top_case(key_switch_sizes, pcb_screw_holes) { hole_x = plate_width / 2 - hole_width / 2; hole_y = plate_length / 2 - hole_length / 2; - linear_extrude(wall_width) difference() { - square([plate_width, plate_length], false); + cube([plate_width, plate_length, wall_width], false); - translate([hole_x, hole_y, 0]) - square([hole_width, hole_length], false); + translate([hole_x, hole_y, -eps]) + cube([hole_width, hole_length, wall_width + 2*eps], false); } } } @@ -307,6 +335,7 @@ module top_case(key_switch_sizes, pcb_screw_holes) { } supports(); + screw_posts(); translate([keyboard_x_offset, keyboard_y_offset, keyboard_deck_z_offset]) keyboard_deck(); -- cgit v1.2.3