summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-12-22 21:34:32 +0100
committerxengineering <me@xengineering.eu>2024-01-02 14:24:06 +0100
commit8184bf87fab1eb415807eba8250af0b812205106 (patch)
treecab3bda42cf3dcecfe78b774197be2baaa03f312
parentac348c4044e6252da91de247d77484509677cca0 (diff)
downloadsoundbox-8184bf87fab1eb415807eba8250af0b812205106.tar
soundbox-8184bf87fab1eb415807eba8250af0b812205106.tar.zst
soundbox-8184bf87fab1eb415807eba8250af0b812205106.zip
mech: Move generic PCB case to own subdirectory
This should be more decoupled because it is not specific to soundbox. It might be later extracted to a library repository.
-rw-r--r--mech/common.scad4
-rw-r--r--mech/pcb_case/common.scad17
-rw-r--r--mech/pcb_case/panel.scad15
-rw-r--r--mech/pcb_case/shell.scad (renamed from mech/pcb_case.scad)34
4 files changed, 36 insertions, 34 deletions
diff --git a/mech/common.scad b/mech/common.scad
index c433447..0ae93a8 100644
--- a/mech/common.scad
+++ b/mech/common.scad
@@ -1,4 +1,6 @@
-use <pcb_case.scad>
+use <pcb_case/common.scad>
+use <pcb_case/shell.scad>
+use <pcb_case/panel.scad>
$fa = 12; // default is 12
$fs = 0.5; // default is 2
diff --git a/mech/pcb_case/common.scad b/mech/pcb_case/common.scad
new file mode 100644
index 0000000..0f79e16
--- /dev/null
+++ b/mech/pcb_case/common.scad
@@ -0,0 +1,17 @@
+nut_h = 3;
+nut_d = 4.15;
+nut_r = nut_d / 2;
+bolt_d = 3;
+bolt_r = bolt_d / 2;
+
+module rounded_cube(dim, radius) {
+ range_y = [radius, dim[1]-radius];
+ range_z = [radius, dim[2]-radius];
+ height = dim[0];
+
+ hull() {
+ for (y=range_y, z=range_z) {
+ translate([0,y,z]) rotate([0,90,0]) cylinder(r=radius, h=height);
+ }
+ }
+}
diff --git a/mech/pcb_case/panel.scad b/mech/pcb_case/panel.scad
new file mode 100644
index 0000000..a42f3a8
--- /dev/null
+++ b/mech/pcb_case/panel.scad
@@ -0,0 +1,15 @@
+use <common.scad>
+
+module pcb_case_panel(dim, t) {
+ rounded_cube([t,dim[1]-2*t,dim[2]-2*t], t);
+}
+
+module pcb_case_panel_back(dim, t) {
+ translate([t,t,t])
+ pcb_case_panel(dim, t);
+}
+
+module pcb_case_panel_front(dim, t) {
+ translate([dim[0]-2*t,t,t])
+ pcb_case_panel(dim, t);
+}
diff --git a/mech/pcb_case.scad b/mech/pcb_case/shell.scad
index bbfe9bc..d7bcecc 100644
--- a/mech/pcb_case.scad
+++ b/mech/pcb_case/shell.scad
@@ -1,22 +1,4 @@
-// A generic parametric PCB case
-
-nut_h = 3;
-nut_d = 4.15;
-nut_r = nut_d / 2;
-bolt_d = 3;
-bolt_r = bolt_d / 2;
-
-module rounded_cube(dim, radius) {
- range_y = [radius, dim[1]-radius];
- range_z = [radius, dim[2]-radius];
- height = dim[0];
-
- hull() {
- for (y=range_y, z=range_z) {
- translate([0,y,z]) rotate([0,90,0]) cylinder(r=radius, h=height);
- }
- }
-}
+use <common.scad>
module shell_base(dim, t) {
radius = t;
@@ -96,17 +78,3 @@ module pcb_case_shell_top(dim, t) {
rotate([180,0,0])
pcb_case_shell(dim, t, 0, []);
}
-
-module pcb_case_panel(dim, t) {
- rounded_cube([t,dim[1]-2*t,dim[2]-2*t], t);
-}
-
-module pcb_case_panel_back(dim, t) {
- translate([t,t,t])
- pcb_case_panel(dim, t);
-}
-
-module pcb_case_panel_front(dim, t) {
- translate([dim[0]-2*t,t,t])
- pcb_case_panel(dim, t);
-}