Compare commits
3 commits
a01323641b
...
bea6302732
Author | SHA1 | Date | |
---|---|---|---|
bea6302732 | |||
63b7d76b17 | |||
4fabdf070d |
3 changed files with 84 additions and 68 deletions
|
@ -3,7 +3,6 @@ $fn=50;
|
|||
|
||||
mode = "case"; // ["case", "lid", "all"]
|
||||
|
||||
project_box(50, 70,
|
||||
above=0,
|
||||
project_box([50, 70, 1],
|
||||
below=1,
|
||||
mode=mode);
|
||||
|
|
|
@ -34,8 +34,7 @@ module cutouts() {
|
|||
square([15,10]);
|
||||
}
|
||||
|
||||
project_box(x, y,
|
||||
above=z,
|
||||
project_box([x, y, z],
|
||||
below=10,
|
||||
mode=mode) {
|
||||
cutouts();
|
||||
|
|
146
project_box.scad
146
project_box.scad
|
@ -22,16 +22,16 @@ corner_radius=3; // [1:10]
|
|||
support_radius=5; // [1:10]
|
||||
wall_width=3; // [3:10]
|
||||
|
||||
module _rounded_box(h, w, d, r) {
|
||||
module _rounded_box(box, r) {
|
||||
hull() {
|
||||
translate([0 + r,0 + r,0])
|
||||
cylinder(h=h,r=r);
|
||||
translate([w - r,0 + r,0])
|
||||
cylinder(h=h, r=r);
|
||||
translate([w - r,d - r,0])
|
||||
cylinder(h=h, r=r);
|
||||
translate([0 + r,d - r,0])
|
||||
cylinder(h=h, r=r);
|
||||
cylinder(h=box.z,r=r);
|
||||
translate([box.x - r,0 + r,0])
|
||||
cylinder(h=box.z, r=r);
|
||||
translate([box.x - r,box.y - r,0])
|
||||
cylinder(h=box.z, r=r);
|
||||
translate([0 + r,box.y - r,0])
|
||||
cylinder(h=box.z, r=r);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,17 +43,17 @@ module corner_post(h, r) {
|
|||
}
|
||||
}
|
||||
|
||||
module lid_base(x, y, z, slot_depth=1.5) {
|
||||
module lid_base(dimensions, slot_depth=1.5) {
|
||||
polyhedron([// bottom face
|
||||
[0, 0, 0],
|
||||
[x, 0, 0],
|
||||
[x, y, 0],
|
||||
[0, y, 0],
|
||||
[dimensions.x, 0, 0],
|
||||
[dimensions.x, dimensions.y, 0],
|
||||
[0, dimensions.y, 0],
|
||||
// top face
|
||||
[slot_depth, 0, z],
|
||||
[x - slot_depth, 0, z],
|
||||
[x - slot_depth, y, z],
|
||||
[slot_depth, y, z]],
|
||||
[slot_depth, 0, dimensions.z],
|
||||
[dimensions.x - slot_depth, 0, dimensions.z],
|
||||
[dimensions.x - slot_depth, dimensions.y, dimensions.z],
|
||||
[slot_depth, dimensions.y, dimensions.z]],
|
||||
[[0,1,2,3],
|
||||
[4,5,1,0],
|
||||
[7,6,5,4],
|
||||
|
@ -62,26 +62,29 @@ module lid_base(x, y, z, slot_depth=1.5) {
|
|||
[7,4,0,3]]);
|
||||
}
|
||||
|
||||
module lid(x, y, z, slot_depth=1.5, wall_width=3, fit_tolerance=0.5) {
|
||||
indent_width = x / 4;
|
||||
module lid(dimensions, slot_depth=1.5, wall_width=3, fit_tolerance=0.5) {
|
||||
indent_width = dimensions.x / 4;
|
||||
difference() {
|
||||
union() {
|
||||
lid_base(x, y, z, slot_depth);
|
||||
lid_base([dimensions.x, dimensions.y, dimensions.z], slot_depth);
|
||||
// locking tab
|
||||
translate([x / 2 - indent_width / 2 - fit_tolerance, y - wall_width - fit_tolerance, 0])
|
||||
translate([dimensions.x / 2 - indent_width / 2 - fit_tolerance,
|
||||
dimensions.y - wall_width - fit_tolerance,
|
||||
0])
|
||||
rotate([0, 90, 0])
|
||||
cylinder(h=x / 4, r=2*fit_tolerance);
|
||||
cylinder(h=dimensions.x / 4, r=2*fit_tolerance);
|
||||
}
|
||||
// pull handle
|
||||
translate([x / 2 - indent_width / 2 - fit_tolerance, y - wall_width + fit_tolerance + 0.001, -0.001]) {
|
||||
cube([indent_width,wall_width - 2 * fit_tolerance,0.6 * z]);
|
||||
cube([indent_width,2 + wall_width - 2 * fit_tolerance,0.3 * z]);
|
||||
translate([dimensions.x / 2 - indent_width / 2 - fit_tolerance,
|
||||
dimensions.y - wall_width + fit_tolerance + 0.001,
|
||||
-0.001]) {
|
||||
cube([indent_width,wall_width - 2 * fit_tolerance,0.6 * dimensions.z]);
|
||||
cube([indent_width,2 + wall_width - 2 * fit_tolerance,0.3 * dimensions.z]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module project_box(x, y,
|
||||
above=20,
|
||||
module project_box(box,
|
||||
below=10,
|
||||
board_thickness=1,
|
||||
fit_tolerance=0.5,
|
||||
|
@ -89,12 +92,18 @@ module project_box(x, y,
|
|||
support_radius=5,
|
||||
wall_width=3,
|
||||
mode="case") {
|
||||
width=board_x + (fit_tolerance * 2);
|
||||
depth=board_y + (fit_tolerance * 2);
|
||||
lid_width = width + wall_width; // Extends halfway into each side wall
|
||||
lid_depth = depth + wall_width; // Extends out of one wall
|
||||
lid_height = wall_width; // Replaces most of the top wall
|
||||
height=board_thickness + above + below + (fit_tolerance * 2) + lid_height;
|
||||
internal_width = box.x + (fit_tolerance * 2); // tolerance on either side
|
||||
internal_depth = box.y + (fit_tolerance * 2); // tolerance on either side
|
||||
|
||||
internal_height = (fit_tolerance // top tolerance
|
||||
+ box.z // project height
|
||||
+ board_thickness // board height
|
||||
+ below // bottom clearance
|
||||
+ fit_tolerance); // bottom tolerance
|
||||
|
||||
lid_width = internal_width + wall_width; // Extends halfway into each side wall
|
||||
lid_depth = internal_depth + wall_width; // Extends out of one wall
|
||||
lid_height = wall_width; // Replaces most of the top wall
|
||||
|
||||
// case
|
||||
if ((mode == "case") || (mode == "all")) {
|
||||
|
@ -102,28 +111,28 @@ module project_box(x, y,
|
|||
union() {
|
||||
// hollow shell
|
||||
difference() {
|
||||
_rounded_box(h=height + (wall_width * 2),
|
||||
w=width + (wall_width * 2),
|
||||
d=depth + (wall_width * 2),
|
||||
_rounded_box([internal_width + (wall_width * 2),
|
||||
internal_depth + (wall_width * 2),
|
||||
internal_height + (wall_width * 2)],
|
||||
r=corner_radius);
|
||||
translate([wall_width,wall_width,wall_width])
|
||||
cube([width, depth, height + (wall_width * 2)]);
|
||||
translate([wall_width,wall_width,wall_width + 0.002])
|
||||
cube([internal_width, internal_depth, internal_height]);
|
||||
// lid slot
|
||||
translate([wall_width / 2, wall_width, height + wall_width + 0.001]) {
|
||||
lid_base(lid_width, lid_depth, lid_height);
|
||||
translate([wall_width / 2, wall_width, internal_height + wall_width + 0.001]) {
|
||||
lid_base([lid_width, lid_depth, lid_height]);
|
||||
}
|
||||
}
|
||||
// supports
|
||||
translate([wall_width,wall_width,wall_width]) {
|
||||
translate([0,0,0])
|
||||
corner_post(h=below, r=support_radius);
|
||||
translate([width,0,0])
|
||||
translate([internal_width, 0, 0])
|
||||
rotate([0,0,90])
|
||||
corner_post(h=below, r=support_radius);
|
||||
translate([0,depth,0])
|
||||
translate([0,internal_depth, 0])
|
||||
rotate([0,0,270])
|
||||
corner_post(h=below, r=support_radius);
|
||||
translate([width,depth,0])
|
||||
translate([internal_width, internal_depth, 0])
|
||||
rotate([0,0,180])
|
||||
corner_post(h=below, r=support_radius);
|
||||
}
|
||||
|
@ -131,24 +140,30 @@ module project_box(x, y,
|
|||
// locking nubs
|
||||
translate([wall_width,wall_width,wall_width]) {
|
||||
nub_size = fit_tolerance * 2;
|
||||
nub_width = board_y / 4;
|
||||
nub_width = box.y / 4;
|
||||
nub_height = below + board_thickness + (nub_size/2) + (fit_tolerance*2);
|
||||
translate([0,board_y / 2 - nub_width / 2,nub_height])
|
||||
translate([0,box.y / 2 - nub_width / 2,nub_height])
|
||||
rotate([270,0,0])
|
||||
cylinder(h=nub_width, r=nub_size/2);
|
||||
translate([width,board_y / 2 - nub_width / 2,nub_height])
|
||||
translate([internal_width,box.y / 2 - nub_width / 2,nub_height])
|
||||
rotate([270,0,0])
|
||||
cylinder(h=nub_width, r=nub_size/2);
|
||||
}
|
||||
if (mode == "all") {
|
||||
// lid
|
||||
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));
|
||||
translate([wall_width / 2 + fit_tolerance,
|
||||
wall_width + fit_tolerance,
|
||||
internal_height + wall_width + fit_tolerance]) {
|
||||
lid([lid_width - (fit_tolerance * 2),
|
||||
lid_depth - (fit_tolerance * 2),
|
||||
lid_height - (fit_tolerance * 2)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// cutouts
|
||||
translate([wall_width + fit_tolerance, wall_width + fit_tolerance, wall_width + below])
|
||||
translate([wall_width + fit_tolerance,
|
||||
wall_width + fit_tolerance,
|
||||
fit_tolerance + wall_width + below + board_thickness])
|
||||
children();
|
||||
}
|
||||
} else if (mode == "lid") {
|
||||
|
@ -156,7 +171,9 @@ module project_box(x, y,
|
|||
translate([lid_width - (fit_tolerance * 2),0,lid_height - (fit_tolerance * 2)]) {
|
||||
rotate([0, 180, 0]) {
|
||||
difference() {
|
||||
lid(lid_width - (fit_tolerance * 2), lid_depth - (fit_tolerance * 2), lid_height - (fit_tolerance * 2));
|
||||
lid([lid_width - (fit_tolerance * 2),
|
||||
lid_depth - (fit_tolerance * 2),
|
||||
lid_height - (fit_tolerance * 2)]);
|
||||
translate([wall_width + fit_tolerance, wall_width + fit_tolerance, -0.001])
|
||||
children();
|
||||
}
|
||||
|
@ -165,39 +182,40 @@ module project_box(x, y,
|
|||
}
|
||||
}
|
||||
|
||||
module cutout_front(volume) {
|
||||
module cutout_front(box, wall_width=3, fit_tolerance=0.5) {
|
||||
rotate([90, 0, 0])
|
||||
linear_extrude(height=volume.y * 2)
|
||||
linear_extrude(height=wall_width + fit_tolerance + 0.001)
|
||||
children(0);
|
||||
}
|
||||
|
||||
module cutout_back(volume) {
|
||||
translate([volume.x,0,0])
|
||||
module cutout_back(box, wall_width=3, fit_tolerance=0.5) {
|
||||
translate([box.x,box.y,0])
|
||||
rotate([90, 0, 180])
|
||||
linear_extrude(height=volume.y * 2)
|
||||
linear_extrude(height=wall_width + fit_tolerance + .001)
|
||||
children(0);
|
||||
}
|
||||
|
||||
module cutout_right(volume) {
|
||||
rotate([90, 0, 90])
|
||||
linear_extrude(height=volume.x * 2)
|
||||
module cutout_right(box, wall_width=3, fit_tolerance=0.5) {
|
||||
translate([box.x,0,0])
|
||||
rotate([90, 0, 90])
|
||||
linear_extrude(height=wall_width + fit_tolerance + 0.001)
|
||||
children(0);
|
||||
}
|
||||
|
||||
module cutout_left(volume) {
|
||||
translate([volume.x, volume.y, 0])
|
||||
module cutout_left(box, wall_width=3, fit_tolerance=0.5) {
|
||||
translate([0, box.y, 0])
|
||||
rotate([90, 0, 270])
|
||||
linear_extrude(height=volume.x * 2)
|
||||
linear_extrude(height=wall_width + fit_tolerance + 0.001)
|
||||
children(0);
|
||||
}
|
||||
|
||||
module cutout_top(volume) {
|
||||
linear_extrude(height=volume.y * 2)
|
||||
module cutout_top(box, wall_width=3, fit_tolerance=0.5) {
|
||||
translate([0, 0, box.z])
|
||||
linear_extrude(height=wall_width + fit_tolerance + 0.001)
|
||||
children(0);
|
||||
}
|
||||
|
||||
project_box(board_x, board_y,
|
||||
above=clearance_above,
|
||||
project_box([board_x, board_y, clearance_above],
|
||||
below=clearance_below,
|
||||
board_thickness=board_thickness,
|
||||
fit_tolerance=fit_tolerance,
|
||||
|
|
Loading…
Reference in a new issue