Compare commits

...

2 commits

Author SHA1 Message Date
635e1a98ae [project_box] Add lid 2022-12-06 16:19:45 -05:00
7cd13f0eb2 [project_box] Fix locking nub size 2022-12-06 15:16:28 -05:00
2 changed files with 77 additions and 42 deletions

View file

@ -1,6 +1,9 @@
use <project_box.scad> use <project_box.scad>
$fn=50; $fn=50;
mode = "case"; // ["case", "lid", "all"]
project_box(50, 70, project_box(50, 70,
above=0, above=0,
below=1); below=1,
mode=mode);

View file

@ -1,12 +1,13 @@
/* Project box /* Project box
A parametric box for electronics projects using perforated circuit boards. The A parametric box for electronics projects using perforated circuit boards. The
board is held above the bottom of the box by four corner supports, and snaps board is held above the bottom of the box by four corner supports, and snaps
into place to hold it snugly while allowing easy removal. into place to hold it snugly while allowing easy removal.
*/ */
$fn=50; $fn=50;
mode = "case"; // ["case", "lid", "all"]
board_x = 50; board_x = 50;
board_y = 70; board_y = 70;
board_thickness = 1; // [1:10] board_thickness = 1; // [1:10]
@ -58,6 +59,21 @@ module lid_base(x, y, z, slot_depth=1.5) {
[7,4,0,3]]); [7,4,0,3]]);
} }
module lid(x, y, z, slot_depth=1.5, wall_width=3, fit_tolerance=0.5) {
indent_width = x / 4;
difference() {
union() {
lid_base(x, y, z, slot_depth);
translate([x / 2 - indent_width / 2 - fit_tolerance, y - wall_width - fit_tolerance, 0])
rotate([0, 90, 0])
cylinder(h=x / 4, r=2*fit_tolerance);
}
translate([x / 2 - indent_width / 2 - fit_tolerance, y - wall_width - fit_tolerance, z])
rotate([0, 90, 0])
cylinder(h=x / 4, r=2*fit_tolerance);
}
}
module project_box(x, y, module project_box(x, y,
above=20, above=20,
below=10, below=10,
@ -65,7 +81,8 @@ module project_box(x, y,
fit_tolerance=0.5, fit_tolerance=0.5,
corner_radius=3, corner_radius=3,
support_radius=5, support_radius=5,
wall_width=3) { wall_width=3,
mode="case") {
width=board_x + (fit_tolerance * 2); width=board_x + (fit_tolerance * 2);
depth=board_y + (fit_tolerance * 2); depth=board_y + (fit_tolerance * 2);
lid_width = width + wall_width; // Extends halfway into each side wall lid_width = width + wall_width; // Extends halfway into each side wall
@ -73,7 +90,20 @@ module project_box(x, y,
lid_height = wall_width; // Replaces most of the top wall lid_height = wall_width; // Replaces most of the top wall
height=board_thickness + above + below + (fit_tolerance * 2) + lid_height; height=board_thickness + above + below + (fit_tolerance * 2) + lid_height;
// container // lid
if (mode == "all") {
translate([wall_width / 2 + fit_tolerance, wall_width + fit_tolerance, height + wall_width + fit_tolerance]) {
lid(lid_width - (fit_tolerance * 2), lid_depth - (fit_tolerance * 2), lid_height - (fit_tolerance * 2));
}
} else if (mode == "lid") {
// Flip the lid and translate it into place for printing
translate([lid_width - (fit_tolerance * 2),0,lid_height - (fit_tolerance * 2)])
rotate([0, 180, 0])
lid(lid_width - (fit_tolerance * 2), lid_depth - (fit_tolerance * 2), lid_height - (fit_tolerance * 2));
}
// case
if ((mode == "case") || (mode == "all")) {
difference() { difference() {
_rounded_box(h=height + (wall_width * 2), _rounded_box(h=height + (wall_width * 2),
w=width + (wall_width * 2), w=width + (wall_width * 2),
@ -105,15 +135,16 @@ module project_box(x, y,
// locking nubs // locking nubs
translate([wall_width,wall_width,wall_width]) { translate([wall_width,wall_width,wall_width]) {
nub_size = 1; nub_size = fit_tolerance * 2;
nub_width = board_y / 4; nub_width = board_y / 4;
nub_height = below + board_thickness + (nub_size/2) + (fit_tolerance*2); nub_height = below + board_thickness + (nub_size/2) + (fit_tolerance*2);
translate([0,board_y / 2 - nub_width / 2,nub_height]) translate([0,board_y / 2 - nub_width / 2,nub_height])
rotate([270,0,0]) rotate([270,0,0])
cylinder(h=nub_width, r=1); cylinder(h=nub_width, r=nub_size/2);
translate([width,board_y / 2 - nub_width / 2,nub_height]) translate([width,board_y / 2 - nub_width / 2,nub_height])
rotate([270,0,0]) rotate([270,0,0])
cylinder(h=nub_width, r=1); cylinder(h=nub_width, r=nub_size/2);
}
} }
} }
@ -124,4 +155,5 @@ project_box(board_x, board_y,
fit_tolerance=fit_tolerance, fit_tolerance=fit_tolerance,
corner_radius=corner_radius, corner_radius=corner_radius,
support_radius=support_radius, support_radius=support_radius,
wall_width=wall_width); wall_width=wall_width,
mode=mode);