summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXANTRONIX Development2023-11-11 14:21:39 -0500
committerXANTRONIX Development2023-11-11 14:21:39 -0500
commitec44dc2e6aae98daa68eff305a0a11fc71290dbb (patch)
tree0211f1eb35c748c214dfde8f69db44ec13bbdb5d
parentb46f3dd3749412413a8c401958607f3efbcc66ed (diff)
downloadxantronix-z32-ec44dc2e6aae98daa68eff305a0a11fc71290dbb.tar.gz
xantronix-z32-ec44dc2e6aae98daa68eff305a0a11fc71290dbb.tar.bz2
xantronix-z32-ec44dc2e6aae98daa68eff305a0a11fc71290dbb.zip
Try to do a proper job of this
-rw-r--r--case/case.scad119
1 files changed, 48 insertions, 71 deletions
diff --git a/case/case.scad b/case/case.scad
index 7745975..db677a9 100644
--- a/case/case.scad
+++ b/case/case.scad
@@ -1,84 +1,61 @@
-pcb_clearance_edge = 1.0;
-pcb_clearance_bottom = 2.0;
+$fn = 72;
pcb_width = 257.175;
pcb_height = 95.250;
-corner_radius = 0.5;
-$fn = 72;
+module keyboard_base_plate(pcb_width, pcb_height) {
+ pcb_clearance_edge = 1.0;
+ pcb_clearance_bottom = 2.0;
-/* Lower left rounded corner */
-rotate([-90, 90, 90])
- rotate_extrude(angle = 90) {
- intersection() {
- circle(r=corner_radius);
- square(corner_radius*2);
- }
- }
-
-/* Lower right rounded corner */
-translate([pcb_width, 0, 0])
-rotate([270, 0, 0])
-linear_extrude(pcb_height)
- intersection() {
- circle(r=corner_radius);
- square(corner_radius*2);
- }
-
-/* Upper left rounded corner */
-translate([0, pcb_height, 0])
-rotate([0, 90, 90])
- rotate_extrude(angle = 90) {
- intersection() {
- circle(r=corner_radius);
- square(corner_radius*2);
- }
- }
-
-/* Upper right rounded corner */
-translate([pcb_width, pcb_height, 0])
-rotate([90, 90, 90])
- rotate_extrude(angle = 90) {
- intersection() {
- circle(r=corner_radius);
- square(corner_radius*2);
+ corner_radius = 0.5;
+
+ module corner(translation, rotation) {
+ translate(translation)
+ rotate(rotation)
+ rotate_extrude(angle=90) {
+ intersection() {
+ circle(r=corner_radius);
+ square(corner_radius*2);
+ }
}
}
-/* Left rounded edge */
-rotate([270, 90, 0])
-linear_extrude(pcb_height)
- intersection() {
- circle(r=corner_radius);
- square(corner_radius*2);
- }
-
-/* Bottom rounded edge */
-rotate([90, 180, 90])
-linear_extrude(pcb_width)
- intersection() {
- circle(r=corner_radius);
- square(corner_radius*2);
- }
-
-/* Right rounded edge */
-translate([pcb_width, 0, 0])
-rotate([180, 90, 90])
- rotate_extrude(angle = 90) {
+ module edge(length, translation, rotation) {
+ translate(translation)
+ rotate(rotation)
+ linear_extrude(length)
intersection() {
circle(r=corner_radius);
square(corner_radius*2);
}
}
-
-
-/* Top rounded edge */
-translate([0, pcb_height, 0])
-rotate([0, 90, 0])
-linear_extrude(pcb_width)
- intersection() {
- circle(r=corner_radius);
- square(corner_radius*2);
- }
-
-square([pcb_width, pcb_height], false); \ No newline at end of file
+
+ /* Lower left rounded corner */
+ corner([0, 0, 0], [-90, 90, 90]);
+
+ /* Upper left rounded corner */
+ corner([0, pcb_height, 0], [0, 90, 90]);
+
+ /* Upper right rounded corner */
+ corner([pcb_width, pcb_height, 0], [90, 90, 90]);
+
+ /* Lower right rounded corner */
+ corner([pcb_width, 0, 0], [180, 90, 90]);
+
+ /* Top edge */
+ edge(pcb_width, [0, pcb_height, 0], [0, 90, 0]);
+
+ /* Right edge */
+ edge(pcb_height, [pcb_width, 0, 0], [270, 0, 0]);
+
+ /* Bottom edge */
+ edge(pcb_width, [0, 0, 0], [90, 180, 90]);
+
+ /* Left edge */
+ edge(pcb_height, [0, 0, 0], [270, 90, 0]);
+
+ linear_extrude(corner_radius*2);
+ square([pcb_width, pcb_height], false);
+}
+
+keyboard_base_plate(pcb_width, pcb_height);