diff options
author | XANTRONIX Development | 2023-11-14 12:10:29 -0500 |
---|---|---|
committer | XANTRONIX Development | 2023-11-14 12:15:34 -0500 |
commit | 19ab60754c06dba1cddd9a38bdbe02a25c64aae7 (patch) | |
tree | 269b8d65fc31f20ab2dbf536e4ef49555209572f /case | |
parent | f77950211925275edb0958bffceb96cae4dddf5a (diff) | |
download | xantronix-z32-19ab60754c06dba1cddd9a38bdbe02a25c64aae7.tar.gz xantronix-z32-19ab60754c06dba1cddd9a38bdbe02a25c64aae7.tar.bz2 xantronix-z32-19ab60754c06dba1cddd9a38bdbe02a25c64aae7.zip |
Start undoing the brain worms
Diffstat (limited to 'case')
-rw-r--r-- | case/case.scad | 166 |
1 files changed, 79 insertions, 87 deletions
diff --git a/case/case.scad b/case/case.scad index dbb649b..318827f 100644 --- a/case/case.scad +++ b/case/case.scad @@ -48,9 +48,8 @@ module keyboard_base_plate(pcb_dimensions, pcb_screw_holes, switch_z_range) { bottom_length = 2 * (pcb_clearance_edge) + pcb_length; bottom_height = thickness; - module round_corner(translation, rotation) { + module round_corner(rotation) { color(case_color) - translate(translation) rotate(rotation) rotate_extrude(angle=90) { intersection() { @@ -60,9 +59,8 @@ module keyboard_base_plate(pcb_dimensions, pcb_screw_holes, switch_z_range) { } } - module round_edge(translation, rotation, length) { + module round_edge(rotation, length) { color(case_color) - translate(translation) rotate(rotation) linear_extrude(length) intersection() { @@ -71,16 +69,14 @@ module keyboard_base_plate(pcb_dimensions, pcb_screw_holes, switch_z_range) { } } - module panel(translation, dimensions) { + module panel(dimensions) { color(case_color) - translate(translation) linear_extrude(dimensions[2]) square([dimensions[0], dimensions[1]], false); } - module wall_corner(translation, rotation, radius, length) { + module wall_corner(rotation, radius, length) { color(case_color) - translate(translation) rotate(rotation) linear_extrude(length) intersection() { @@ -89,12 +85,11 @@ module keyboard_base_plate(pcb_dimensions, pcb_screw_holes, switch_z_range) { } } - module screw_post(translation, h, d) { + module screw_post(h, d) { diameter_outer = 3 * d; diameter_inner = d; color(case_color) - translate(translation) difference() { cylinder(h=h, r1 = (diameter_outer / 2.0) * 1.5); cylinder(h=h, r = diameter_inner / 2.0); @@ -113,136 +108,133 @@ module keyboard_base_plate(pcb_dimensions, pcb_screw_holes, switch_z_range) { ]; for (y = horizontal) { - panel([0 - pcb_clearance_edge, y, 0], - [bottom_width, width, height]); + translate([0 - pcb_clearance_edge, y, 0]) + panel([bottom_width, width, height]); } for (x = vertical) { - panel([x, 0 - pcb_clearance_edge, 0], - [width, bottom_length, height]); + translate([x, 0 - pcb_clearance_edge, 0]) + panel([width, bottom_length, height]); } } /* Upper wall */ - panel([-pcb_clearance_edge - thickness + corner_radius, - pcb_clearance_edge + pcb_length, - -thickness + corner_radius], - [wall_width, thickness, wall_height + thickness - corner_radius]); + + translate([-pcb_clearance_edge - thickness + corner_radius, + pcb_clearance_edge + pcb_length, + -thickness + corner_radius]) + panel([wall_width, thickness, wall_height + thickness - corner_radius]); /* Right wall */ - panel([ pcb_clearance_edge + pcb_width, - -pcb_clearance_edge - thickness + corner_radius, - -thickness + corner_radius], - [thickness, wall_length, wall_height + thickness - corner_radius]); + translate([ pcb_clearance_edge + pcb_width, + -pcb_clearance_edge - thickness + corner_radius, + -thickness + corner_radius]) + panel([thickness, wall_length, wall_height + thickness - corner_radius]); /* Lower wall */ - panel([-pcb_clearance_edge - thickness + corner_radius, - -pcb_clearance_edge - thickness, - -thickness + corner_radius], - [wall_width, thickness, wall_height + thickness - corner_radius]); + translate([-pcb_clearance_edge - thickness + corner_radius, + -pcb_clearance_edge - thickness, + -thickness + corner_radius]) + panel([wall_width, thickness, wall_height + thickness - corner_radius]); /* Left wall */ - panel([-pcb_clearance_edge - thickness, - -pcb_clearance_edge - thickness + corner_radius, - -thickness + corner_radius], - [thickness, wall_length, wall_height + thickness - corner_radius]); + translate([-pcb_clearance_edge - thickness, + -pcb_clearance_edge - thickness + corner_radius, + -thickness + corner_radius]) + panel([thickness, wall_length, wall_height + thickness - corner_radius]); /* Upper right wall corner */ - wall_corner([pcb_clearance_edge + thickness + pcb_width - corner_radius, - pcb_clearance_edge + thickness + pcb_length - corner_radius, - -thickness + corner_radius], - [0, 0, 0], + translate([pcb_clearance_edge + thickness + pcb_width - corner_radius, + pcb_clearance_edge + thickness + pcb_length - corner_radius, + -thickness + corner_radius]) + wall_corner([0, 0, 0], corner_radius, wall_height + thickness - corner_radius); /* Lower right wall corner */ - wall_corner([ pcb_clearance_edge + thickness + pcb_width - corner_radius, + translate([ pcb_clearance_edge + thickness + pcb_width - corner_radius, -pcb_clearance_edge - thickness + corner_radius, - -thickness + corner_radius], - [0, 0, 270], + -thickness + corner_radius]) + wall_corner([0, 0, 270], corner_radius, wall_height + thickness - corner_radius); /* Lower left wall corner */ - wall_corner([-pcb_clearance_edge - thickness + corner_radius, - -pcb_clearance_edge - thickness + corner_radius, - -thickness + corner_radius], - [0, 0, 180], + translate([-pcb_clearance_edge - thickness + corner_radius, + -pcb_clearance_edge - thickness + corner_radius, + -thickness + corner_radius]) + wall_corner([0, 0, 180], corner_radius, wall_height + thickness - corner_radius); /* Upper left wall corner */ - wall_corner([-pcb_clearance_edge - thickness + corner_radius, - pcb_clearance_edge + pcb_length + thickness - corner_radius, - -thickness + corner_radius], - [0, 0, 90], + translate([-pcb_clearance_edge - thickness + corner_radius, + pcb_clearance_edge + pcb_length + thickness - corner_radius, + -thickness + corner_radius]) + wall_corner([0, 0, 90], corner_radius, wall_height + thickness - corner_radius); /* Bottom plate */ - panel([-pcb_clearance_edge - thickness + corner_radius, - -pcb_clearance_edge - thickness + corner_radius, - -thickness], - [bottom_width + 2 * thickness - 2 * corner_radius, + translate([-pcb_clearance_edge - thickness + corner_radius, + -pcb_clearance_edge - thickness + corner_radius, + -thickness]) + panel([bottom_width + 2 * thickness - 2 * corner_radius, bottom_length + 2 * thickness - 2 * corner_radius, thickness]); /* Upper edge */ - round_edge([-pcb_clearance_edge - thickness + corner_radius, - pcb_clearance_edge + thickness + pcb_length - corner_radius, - -thickness + corner_radius], - [0, 90, 0], - wall_width); + translate([-pcb_clearance_edge - thickness + corner_radius, + pcb_clearance_edge + thickness + pcb_length - corner_radius, + -thickness + corner_radius]) + round_edge([0, 90, 0], wall_width); /* Right edge */ - round_edge([ pcb_clearance_edge + thickness + pcb_width - corner_radius, - -pcb_clearance_edge - thickness + corner_radius, - -thickness + corner_radius], - [270, 0, 0], - wall_length); + translate([ pcb_clearance_edge + thickness + pcb_width - corner_radius, + -pcb_clearance_edge - thickness + corner_radius, + -thickness + corner_radius]) + round_edge([270, 0, 0], wall_length); /* Lower edge */ - round_edge([-pcb_clearance_edge - thickness + corner_radius, - -pcb_clearance_edge - thickness + corner_radius, - -thickness + corner_radius], - [90, 180, 90], - wall_width); + translate([-pcb_clearance_edge - thickness + corner_radius, + -pcb_clearance_edge - thickness + corner_radius, + -thickness + corner_radius]) + round_edge([90, 180, 90], wall_width); /* Left edge */ - round_edge([-pcb_clearance_edge - thickness + corner_radius, - -pcb_clearance_edge - thickness + corner_radius, - -thickness + corner_radius], - [270, 90, 0], - wall_length); + translate([-pcb_clearance_edge - thickness + corner_radius, + -pcb_clearance_edge - thickness + corner_radius, + -thickness + corner_radius]) + round_edge([270, 90, 0], wall_length); /* Upper right corner */ - round_corner([pcb_clearance_edge + thickness + pcb_width - corner_radius, - pcb_clearance_edge + thickness + pcb_length - corner_radius, - -thickness + corner_radius], - [90, 90, 90]); + translate([pcb_clearance_edge + thickness + pcb_width - corner_radius, + pcb_clearance_edge + thickness + pcb_length - corner_radius, + -thickness + corner_radius]) + round_corner([90, 90, 90]); /* Lower right corner */ - round_corner([ pcb_clearance_edge + thickness + pcb_width - corner_radius, - -pcb_clearance_edge - thickness + corner_radius, - -thickness + corner_radius], - [180, 90, 90]); + translate([ pcb_clearance_edge + thickness + pcb_width - corner_radius, + -pcb_clearance_edge - thickness + corner_radius, + -thickness + corner_radius]) + round_corner([180, 90, 90]); /* Lower left corner */ - round_corner([-pcb_clearance_edge - thickness + corner_radius, - -pcb_clearance_edge - thickness + corner_radius, - -thickness + corner_radius], - [-90, 90, 90]); + translate([-pcb_clearance_edge - thickness + corner_radius, + -pcb_clearance_edge - thickness + corner_radius, + -thickness + corner_radius]) + round_corner([-90, 90, 90]); /* Upper left corner */ - round_corner([-pcb_clearance_edge - thickness + corner_radius, - pcb_clearance_edge + thickness + pcb_length - corner_radius, - -thickness + corner_radius], - [0, 90, 90]); + translate([-pcb_clearance_edge - thickness + corner_radius, + pcb_clearance_edge + thickness + pcb_length - corner_radius, + -thickness + corner_radius]) + round_corner([0, 90, 90]); /* Screw holes */ for (screw_hole = pcb_screw_holes) { - screw_post([screw_hole[0], screw_hole[1], 0], - pcb_screw_height, + translate([screw_hole[0], screw_hole[1], 0]) + screw_post(pcb_screw_height, pcb_screw_diameter); } |