summaryrefslogtreecommitdiff
path: root/case/pcb_case/tolerance_tests.scad
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2024-12-24 12:39:34 +0100
committerxengineering <me@xengineering.eu>2024-12-26 12:06:36 +0100
commitdb966c966929dd3abc29ebab7ce47d638ba4a94f (patch)
treeaf2b844a2938de1698712642261bc2f8aa52732a /case/pcb_case/tolerance_tests.scad
parent03d41e8069623b5d627dfb298c471a16c380c91d (diff)
downloadsoundbox-db966c966929dd3abc29ebab7ce47d638ba4a94f.tar
soundbox-db966c966929dd3abc29ebab7ce47d638ba4a94f.tar.zst
soundbox-db966c966929dd3abc29ebab7ce47d638ba4a94f.zip
WIP: Move `mech` directory to `case`
TODO: There are outdated references (see grep -R mech .) The directory name should reflect what is inside, not the field of engineering it belongs to.
Diffstat (limited to 'case/pcb_case/tolerance_tests.scad')
-rw-r--r--case/pcb_case/tolerance_tests.scad86
1 files changed, 86 insertions, 0 deletions
diff --git a/case/pcb_case/tolerance_tests.scad b/case/pcb_case/tolerance_tests.scad
new file mode 100644
index 0000000..94911cd
--- /dev/null
+++ b/case/pcb_case/tolerance_tests.scad
@@ -0,0 +1,86 @@
+include <bolt.scad>
+include <nut.scad>
+include <panel.scad>
+
+use <rounded_cube.scad>
+
+t = 2;
+step_width = 0.15;
+
+module bolt_drilling() {
+ steps = 2;
+
+ for(i = [-steps : steps]) {
+ tol = bolt_ds_tol + i * step_width;
+ echo(bolt_ds_tol=tol);
+ translate([i*5*bolt_ds,0,0])
+ difference() {
+ cube([5*bolt_ds, 5*bolt_ds, t]);
+ translate([2.5*bolt_ds,2.5*bolt_ds,0]) {
+ cylinder(d=bolt_ds+tol,h=t,$fn=50);
+ }
+ }
+ }
+}
+
+module nut_drilling() {
+ steps = 2;
+
+ for(i = [-steps : steps]) {
+ tol = nut_d_tol + i * step_width;
+ echo(nut_d_tol=tol);
+ translate([i*5*nut_d,0,0])
+ difference() {
+ cube([5*nut_d, 5*nut_d, 2*nut_h]);
+ translate([2.5*nut_d,2.5*nut_d,0]) {
+ union() {
+ cylinder(d=bolt_ds+bolt_ds_tol,h=2*nut_h,$fn=50);
+ translate([0,0,nut_h])
+ cylinder(d=tol+nut_d,h=nut_h,$fn=50);
+ }
+ }
+ }
+ }
+}
+
+module panel_thickness() {
+ steps = 2;
+
+ height = 2*t;
+
+ for(i = [-steps : steps]) {
+ tol = panel_dim_0_tol + i * step_width;
+ echo(panel_dim_0_tol=tol);
+ translate([i*5*t,0,0])
+ difference() {
+ cube([5*t, 5*t, height]);
+ translate([2*t, 0, t]) {
+ cube([t+tol, 5*t, t]);
+ }
+ }
+ }
+}
+
+module panel_width_height() {
+ steps = 2;
+
+ height = 3*t;
+
+ for(i = [-steps : steps]) {
+ tol = panel_dim_1_2_tol + i * step_width;
+ echo(panel_dim_1_2_tol=tol);
+ translate([i*3*t,0,0])
+ difference() {
+ cube([3*t, 8*t, height]);
+ translate([t, t-tol/2, t]) {
+ rounded_cube([t+panel_dim_0_tol, 6*t+tol, 6*t+tol], t);
+ }
+ }
+ }
+}
+
+bolt_drilling();
+translate([0, 20, 0]) nut_drilling();
+translate([0, 70, 0]) panel_thickness();
+translate([0, 50, 0]) panel_width_height();
+translate([0, 85, 0]) rotate([0, -90, 0]) rounded_cube([t, 6*t, 6*t], t);