Start undoing the brain worms

This commit is contained in:
XANTRONIX 2023-11-14 12:10:29 -05:00
parent f779502119
commit 19ab60754c

View file

@ -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_length = 2 * (pcb_clearance_edge) + pcb_length;
bottom_height = thickness; bottom_height = thickness;
module round_corner(translation, rotation) { module round_corner(rotation) {
color(case_color) color(case_color)
translate(translation)
rotate(rotation) rotate(rotation)
rotate_extrude(angle=90) { rotate_extrude(angle=90) {
intersection() { 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) color(case_color)
translate(translation)
rotate(rotation) rotate(rotation)
linear_extrude(length) linear_extrude(length)
intersection() { 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) color(case_color)
translate(translation)
linear_extrude(dimensions[2]) linear_extrude(dimensions[2])
square([dimensions[0], dimensions[1]], false); square([dimensions[0], dimensions[1]], false);
} }
module wall_corner(translation, rotation, radius, length) { module wall_corner(rotation, radius, length) {
color(case_color) color(case_color)
translate(translation)
rotate(rotation) rotate(rotation)
linear_extrude(length) linear_extrude(length)
intersection() { 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_outer = 3 * d;
diameter_inner = d; diameter_inner = d;
color(case_color) color(case_color)
translate(translation)
difference() { difference() {
cylinder(h=h, r1 = (diameter_outer / 2.0) * 1.5); cylinder(h=h, r1 = (diameter_outer / 2.0) * 1.5);
cylinder(h=h, r = diameter_inner / 2.0); 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) { for (y = horizontal) {
panel([0 - pcb_clearance_edge, y, 0], translate([0 - pcb_clearance_edge, y, 0])
[bottom_width, width, height]); panel([bottom_width, width, height]);
} }
for (x = vertical) { for (x = vertical) {
panel([x, 0 - pcb_clearance_edge, 0], translate([x, 0 - pcb_clearance_edge, 0])
[width, bottom_length, height]); panel([width, bottom_length, height]);
} }
} }
/* Upper wall */ /* Upper wall */
panel([-pcb_clearance_edge - thickness + corner_radius,
pcb_clearance_edge + pcb_length, translate([-pcb_clearance_edge - thickness + corner_radius,
-thickness + corner_radius], pcb_clearance_edge + pcb_length,
[wall_width, thickness, wall_height + thickness - corner_radius]); -thickness + corner_radius])
panel([wall_width, thickness, wall_height + thickness - corner_radius]);
/* Right wall */ /* Right wall */
panel([ pcb_clearance_edge + pcb_width, translate([ pcb_clearance_edge + pcb_width,
-pcb_clearance_edge - thickness + corner_radius, -pcb_clearance_edge - thickness + corner_radius,
-thickness + corner_radius], -thickness + corner_radius])
[thickness, wall_length, wall_height + thickness - corner_radius]); panel([thickness, wall_length, wall_height + thickness - corner_radius]);
/* Lower wall */ /* Lower wall */
panel([-pcb_clearance_edge - thickness + corner_radius, translate([-pcb_clearance_edge - thickness + corner_radius,
-pcb_clearance_edge - thickness, -pcb_clearance_edge - thickness,
-thickness + corner_radius], -thickness + corner_radius])
[wall_width, thickness, wall_height + thickness - corner_radius]); panel([wall_width, thickness, wall_height + thickness - corner_radius]);
/* Left wall */ /* Left wall */
panel([-pcb_clearance_edge - thickness, translate([-pcb_clearance_edge - thickness,
-pcb_clearance_edge - thickness + corner_radius, -pcb_clearance_edge - thickness + corner_radius,
-thickness + corner_radius], -thickness + corner_radius])
[thickness, wall_length, wall_height + thickness - corner_radius]); panel([thickness, wall_length, wall_height + thickness - corner_radius]);
/* Upper right wall corner */ /* Upper 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 + pcb_length - corner_radius, pcb_clearance_edge + thickness + pcb_length - corner_radius,
-thickness + corner_radius], -thickness + corner_radius])
[0, 0, 0], wall_corner([0, 0, 0],
corner_radius, corner_radius,
wall_height + thickness - corner_radius); wall_height + thickness - corner_radius);
/* Lower right wall corner */ /* 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, -pcb_clearance_edge - thickness + corner_radius,
-thickness + corner_radius], -thickness + corner_radius])
[0, 0, 270], wall_corner([0, 0, 270],
corner_radius, corner_radius,
wall_height + thickness - corner_radius); wall_height + thickness - corner_radius);
/* Lower left wall corner */ /* Lower left wall corner */
wall_corner([-pcb_clearance_edge - thickness + corner_radius, translate([-pcb_clearance_edge - thickness + corner_radius,
-pcb_clearance_edge - thickness + corner_radius, -pcb_clearance_edge - thickness + corner_radius,
-thickness + corner_radius], -thickness + corner_radius])
[0, 0, 180], wall_corner([0, 0, 180],
corner_radius, corner_radius,
wall_height + thickness - corner_radius); wall_height + thickness - corner_radius);
/* Upper left wall corner */ /* Upper left wall corner */
wall_corner([-pcb_clearance_edge - thickness + corner_radius, translate([-pcb_clearance_edge - thickness + corner_radius,
pcb_clearance_edge + pcb_length + thickness - corner_radius, pcb_clearance_edge + pcb_length + thickness - corner_radius,
-thickness + corner_radius], -thickness + corner_radius])
[0, 0, 90], wall_corner([0, 0, 90],
corner_radius, corner_radius,
wall_height + thickness - corner_radius); wall_height + thickness - corner_radius);
/* Bottom plate */ /* Bottom plate */
panel([-pcb_clearance_edge - thickness + corner_radius, translate([-pcb_clearance_edge - thickness + corner_radius,
-pcb_clearance_edge - thickness + corner_radius, -pcb_clearance_edge - thickness + corner_radius,
-thickness], -thickness])
[bottom_width + 2 * thickness - 2 * corner_radius, panel([bottom_width + 2 * thickness - 2 * corner_radius,
bottom_length + 2 * thickness - 2 * corner_radius, bottom_length + 2 * thickness - 2 * corner_radius,
thickness]); thickness]);
/* Upper edge */ /* Upper edge */
round_edge([-pcb_clearance_edge - thickness + corner_radius, translate([-pcb_clearance_edge - thickness + corner_radius,
pcb_clearance_edge + thickness + pcb_length - corner_radius, pcb_clearance_edge + thickness + pcb_length - corner_radius,
-thickness + corner_radius], -thickness + corner_radius])
[0, 90, 0], round_edge([0, 90, 0], wall_width);
wall_width);
/* Right edge */ /* Right edge */
round_edge([ pcb_clearance_edge + thickness + pcb_width - corner_radius, translate([ pcb_clearance_edge + thickness + pcb_width - corner_radius,
-pcb_clearance_edge - thickness + corner_radius, -pcb_clearance_edge - thickness + corner_radius,
-thickness + corner_radius], -thickness + corner_radius])
[270, 0, 0], round_edge([270, 0, 0], wall_length);
wall_length);
/* Lower edge */ /* Lower edge */
round_edge([-pcb_clearance_edge - thickness + corner_radius, translate([-pcb_clearance_edge - thickness + corner_radius,
-pcb_clearance_edge - thickness + corner_radius, -pcb_clearance_edge - thickness + corner_radius,
-thickness + corner_radius], -thickness + corner_radius])
[90, 180, 90], round_edge([90, 180, 90], wall_width);
wall_width);
/* Left edge */ /* Left edge */
round_edge([-pcb_clearance_edge - thickness + corner_radius, translate([-pcb_clearance_edge - thickness + corner_radius,
-pcb_clearance_edge - thickness + corner_radius, -pcb_clearance_edge - thickness + corner_radius,
-thickness + corner_radius], -thickness + corner_radius])
[270, 90, 0], round_edge([270, 90, 0], wall_length);
wall_length);
/* Upper right corner */ /* Upper right corner */
round_corner([pcb_clearance_edge + thickness + pcb_width - corner_radius, translate([pcb_clearance_edge + thickness + pcb_width - corner_radius,
pcb_clearance_edge + thickness + pcb_length - corner_radius, pcb_clearance_edge + thickness + pcb_length - corner_radius,
-thickness + corner_radius], -thickness + corner_radius])
[90, 90, 90]); round_corner([90, 90, 90]);
/* Lower right corner */ /* Lower right corner */
round_corner([ pcb_clearance_edge + thickness + pcb_width - corner_radius, translate([ pcb_clearance_edge + thickness + pcb_width - corner_radius,
-pcb_clearance_edge - thickness + corner_radius, -pcb_clearance_edge - thickness + corner_radius,
-thickness + corner_radius], -thickness + corner_radius])
[180, 90, 90]); round_corner([180, 90, 90]);
/* Lower left corner */ /* Lower left corner */
round_corner([-pcb_clearance_edge - thickness + corner_radius, translate([-pcb_clearance_edge - thickness + corner_radius,
-pcb_clearance_edge - thickness + corner_radius, -pcb_clearance_edge - thickness + corner_radius,
-thickness + corner_radius], -thickness + corner_radius])
[-90, 90, 90]); round_corner([-90, 90, 90]);
/* Upper left corner */ /* Upper left corner */
round_corner([-pcb_clearance_edge - thickness + corner_radius, translate([-pcb_clearance_edge - thickness + corner_radius,
pcb_clearance_edge + thickness + pcb_length - corner_radius, pcb_clearance_edge + thickness + pcb_length - corner_radius,
-thickness + corner_radius], -thickness + corner_radius])
[0, 90, 90]); round_corner([0, 90, 90]);
/* Screw holes */ /* Screw holes */
for (screw_hole = pcb_screw_holes) { for (screw_hole = pcb_screw_holes) {
screw_post([screw_hole[0], screw_hole[1], 0], translate([screw_hole[0], screw_hole[1], 0])
pcb_screw_height, screw_post(pcb_screw_height,
pcb_screw_diameter); pcb_screw_diameter);
} }