diff options
author | xengineering <me@xengineering.eu> | 2024-01-02 17:09:17 +0100 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2024-01-02 20:29:40 +0100 |
commit | 5371d56bd722c320c6a76753a6e68d9407cadbe3 (patch) | |
tree | 365cae9f6d1c4b82b783529c17480fc6fc5f0c44 | |
parent | 285e100abf2ec0736cded36aba938098b1b7bb60 (diff) | |
download | soundbox-5371d56bd722c320c6a76753a6e68d9407cadbe3.tar soundbox-5371d56bd722c320c6a76753a6e68d9407cadbe3.tar.zst soundbox-5371d56bd722c320c6a76753a6e68d9407cadbe3.zip |
mech: pcb_case: Switch shell to PCB-based params
After switching the panel to PCB-based dimensions the shell follows with
this commit.
-rw-r--r-- | mech/assembly.scad | 11 | ||||
-rw-r--r-- | mech/parameters.scad | 10 | ||||
-rw-r--r-- | mech/pcb_case/conversion.scad | 7 | ||||
-rw-r--r-- | mech/pcb_case/panel.scad | 13 | ||||
-rw-r--r-- | mech/pcb_case/pcb.scad | 4 | ||||
-rw-r--r-- | mech/pcb_case/shell.scad | 68 | ||||
-rw-r--r-- | mech/production.scad | 13 |
7 files changed, 67 insertions, 59 deletions
diff --git a/mech/assembly.scad b/mech/assembly.scad index 50d074b..87865eb 100644 --- a/mech/assembly.scad +++ b/mech/assembly.scad @@ -7,15 +7,8 @@ use <pcb_case/panel.scad> module assembly() { pcb(pcb_dim, drillings, margins, t); - pcb_case_shell_bottom( - dim, t, h, [ - base_socket, - base_socket + dx, - base_socket + dy, - base_socket + dx + dy - ] - ); -// pcb_case_shell_top(dim, t); + pcb_case_shell_bottom(pcb_dim, drillings, margins, t); +// pcb_case_shell_top(pcb_dim, margins, t); pcb_case_panel_back(pcb_dim, margins, t); // pcb_case_panel_front(pcb_dim, margins, t); } diff --git a/mech/parameters.scad b/mech/parameters.scad index 1cff75e..362b42d 100644 --- a/mech/parameters.scad +++ b/mech/parameters.scad @@ -17,13 +17,3 @@ drillings = [ base_drilling + dy, base_drilling + dx + dy ]; - -// TODO deprecated parameters -tol = 1; -base_socket = [3/2+2.3+2*t+tol,3/2+2.1+2.7+t+tol]; -dim = [ - base_socket[0] + dx[0] + 3/2 + 4 + 2*t + tol, - base_socket[1] + dy[1] + 3/2 + 2 + 0.9 + 6 + t + tol, - 39 // TODO -]; -h = 10; // TODO diff --git a/mech/pcb_case/conversion.scad b/mech/pcb_case/conversion.scad new file mode 100644 index 0000000..1879b7d --- /dev/null +++ b/mech/pcb_case/conversion.scad @@ -0,0 +1,7 @@ +include <nut.scad> + +function dim_pcb_to_case(pcb_dim, margins, t) = [ + pcb_dim[0]+margins[0][0]+margins[0][1]+4*t, + pcb_dim[1]+margins[1][0]+margins[1][1]+2*t+4*nut_h, + pcb_dim[2]+margins[2][0]+margins[2][1]+2*t +]; diff --git a/mech/pcb_case/panel.scad b/mech/pcb_case/panel.scad index 421c1fb..eef0b28 100644 --- a/mech/pcb_case/panel.scad +++ b/mech/pcb_case/panel.scad @@ -1,17 +1,16 @@ include <nut.scad> +use <conversion.scad> use <rounded_cube.scad> panel_dim_0_tol = 0.3; panel_dim_1_2_tol = 0.45; module pcb_case_panel(pcb_dim, margins, t) { + dim = dim_pcb_to_case(pcb_dim, margins, t); + rounded_cube( - dim=[ - t, - pcb_dim[1]+margins[1][0]+margins[1][1]+2*nut_h, - pcb_dim[2]+margins[2][0]+margins[2][1] - ], + dim=[t, dim[1]-2*t, dim[2]-2*t], radius=t ); } @@ -22,6 +21,8 @@ module pcb_case_panel_back(pcb_dim, margins, t) { } module pcb_case_panel_front(pcb_dim, margins, t) { - translate([pcb_dim[0]+margins[0][0]+margins[0][1]+2*t, t, t]) + dim = dim_pcb_to_case(pcb_dim, margins, t); + + translate([dim[0]-2*t, t, t]) pcb_case_panel(pcb_dim, margins, t); } diff --git a/mech/pcb_case/pcb.scad b/mech/pcb_case/pcb.scad index 23602be..e742eb5 100644 --- a/mech/pcb_case/pcb.scad +++ b/mech/pcb_case/pcb.scad @@ -1,5 +1,7 @@ +include <nut.scad> + module pcb(dim, drillings, margins, t) { - translate([2*t+margins[0][0], 2*t+margins[1][0], t+margins[2][0]]) { + translate([2*t+margins[0][0], t+2*nut_h+margins[1][0], t+margins[2][0]]) { difference() { cube([dim[0], dim[1], dim[2]]); for (drilling = drillings) { diff --git a/mech/pcb_case/shell.scad b/mech/pcb_case/shell.scad index 453100a..bb4c554 100644 --- a/mech/pcb_case/shell.scad +++ b/mech/pcb_case/shell.scad @@ -2,13 +2,15 @@ include <bolt.scad> include <nut.scad> include <panel.scad> +use <conversion.scad> use <rounded_cube.scad> -module shell_base(dim, t) { - radius = t; +module shell_base(pcb_dim, margins, t) { + dim = dim_pcb_to_case(pcb_dim, margins, t); + difference() { // full body - rounded_cube(dim, radius); + rounded_cube(dim=dim, radius=t); // cut away upper half translate([0,0,dim[2]/2]) @@ -16,16 +18,24 @@ module shell_base(dim, t) { // main PCB space translate([3*t, t, t]) - rounded_cube([dim[0]-6*t, dim[1]-2*t, dim[2]-2*t], radius); + rounded_cube([dim[0]-6*t, dim[1]-2*t, dim[2]-2*t], t); // remove front and back translate([0, 2*t, 2*t]) - rounded_cube([dim[0], dim[1]-4*t, dim[2]-4*t], radius); + rounded_cube([dim[0], dim[1]-4*t, dim[2]-4*t], t); // panel holder - for (x_off = [t, dim[0]-2*t]) { - translate([x_off, t, t]) - rounded_cube([t+panel_dim_0_tol, dim[1]-2*t+panel_dim_1_2_tol, dim[2]-2*t+panel_dim_1_2_tol], radius); + for (x_off = [t-panel_dim_0_tol/2, dim[0]-2*t-panel_dim_0_tol/2]) { + translate([x_off, t-panel_dim_0_tol/2, t-panel_dim_0_tol/2]) { + rounded_cube( + [ + t+panel_dim_0_tol, + dim[1]-2*t+panel_dim_1_2_tol, + dim[2]-2*t+panel_dim_1_2_tol + ], + t + ); + } } // bolt drillings @@ -37,7 +47,9 @@ module shell_base(dim, t) { } } -module shell_connector(dim, t) { +module shell_connector(pcb_dim, margins, t) { + dim = dim_pcb_to_case(pcb_dim, margins, t); + size_x = dim[0]-6*t; size_y = 2*nut_h; size_z = dim[2]/2+3*bolt_ds; @@ -65,32 +77,40 @@ module shell_connector(dim, t) { echo(min_shell_bolt_length=t+size_y); } -module pcb_case_shell(dim, t, h, sockets) { +module pcb_case_shell(pcb_dim, drillings, margins, t) { difference () { union() { - shell_base(dim, t); - shell_connector(dim, t); - for (socket = sockets) { - echo(socket=socket); - translate([socket[0], socket[1], 0]) - cylinder(d=nut_d+2, h=h, $fn=30); + shell_base(pcb_dim, margins, t); + shell_connector(pcb_dim, margins, t); + for (drilling = drillings) { + translate([ + 2*t+margins[0][0]+drilling[0], + t+2*nut_h+margins[1][0]+drilling[1], + 0 + ]) cylinder(d=nut_d+2, h=t+margins[2][0], $fn=30); } } - for (socket = sockets) { - translate([socket[0], socket[1], 0]) { - cylinder(d=bolt_ds+bolt_ds_tol, h=h, $fn=30); + for (drilling = drillings) { + translate([ + 2*t+margins[0][0]+drilling[0], + t+2*nut_h+margins[1][0]+drilling[1], + 0 + ]) { + cylinder(d=bolt_ds+bolt_ds_tol, h=t+margins[2][0], $fn=30); cylinder(d=nut_d+nut_d_tol, h=nut_h, $fn=30); } } } } -module pcb_case_shell_bottom(dim, t, h, sockets) { - pcb_case_shell(dim, t, h, sockets); +module pcb_case_shell_bottom(pcb_dim, drillings, margins, t) { + pcb_case_shell(pcb_dim, drillings, margins, t); } -module pcb_case_shell_top(dim, t) { - translate([0,dim[1],dim[2]]) +module pcb_case_shell_top(pcb_dim, margins, t) { + dim = dim_pcb_to_case(pcb_dim, margins, t); + + translate([0, dim[1], dim[2]]) rotate([180,0,0]) - pcb_case_shell(dim, t, 0, []); + pcb_case_shell(pcb_dim, [], margins, t); } diff --git a/mech/production.scad b/mech/production.scad index 52e4ece..448a439 100644 --- a/mech/production.scad +++ b/mech/production.scad @@ -1,24 +1,19 @@ include <parameters.scad> +use <pcb_case/conversion.scad> use <pcb_case/shell.scad> use <pcb_case/panel.scad> module production() { + dim = dim_pcb_to_case(pcb_dim, margins, t); spacing = 5; - pcb_case_shell_bottom( - dim, t, h, [ - base_socket, - base_socket + dx, - base_socket + dy, - base_socket + dx + dy - ] - ); + pcb_case_shell_bottom(pcb_dim, drillings, margins, t); translate([-spacing, 0, 0]) rotate([0, 180, 0]) translate([0, 0, -dim[2]]) - pcb_case_shell_top(dim, t); + pcb_case_shell_top(pcb_dim, margins, t); translate([-spacing, dim[1]+spacing, 0]) rotate([0, -90, 0]) |