add recipebox

This commit is contained in:
David 2022-01-08 14:01:13 -05:00
commit f65d7c226f

83
recipebox.scad Normal file
View File

@ -0,0 +1,83 @@
inch=25.4; // treating 1 unit as 1 mm
module box(size=[1, 1, 1], wall) {
innerWidth=size.x;
innerHeight=size.y;
innerDepth=size.z;
outerWidth=innerWidth+wall;
outerHeight=innerHeight+wall+1;
outerDepth=innerDepth+wall;
difference() {
cube([outerWidth, outerDepth, outerHeight],
center=true);
translate([0, 0, wall]) {
cube([innerWidth, innerDepth, innerHeight+0.001],
center=true);
}
}
// ribs
for (i = [ -innerDepth/2+2 : 5 : innerDepth/2 ]) {
translate([innerWidth/2, i, 0]) {
cube([2, 1, innerHeight-10], center=true);
}
translate([-innerWidth/2, i, 0]) {
cube([2, 1, innerHeight-10], center=true);
}
translate([0, i, -innerHeight/2+3]) {
cube([innerWidth-5, 1, 1], center=true);
}
}
}
module cutBox(size=[1,1,1], wall) {
width=size.x;
height=size.y;
depth=size.z;
difference(){
// define box
box([width, height, depth], wall);
// slice off top
translate([0,-15,1.5*inch]) {
rotate([15,0,0]) {
cube([width+wall*2,height*2,depth], center=true);
}
}
}
}
module pattern(size=[1,1,1], squareSize, ribSize) {
width=size.x;
height=size.y;
depth=size.z;
for (i = [ -width/2 : squareSize+ribSize : width/2 ]) {
for (j = [ -depth/2 : squareSize+ribSize : depth/2 ]) {
translate([i, 0, j]) {
cube([squareSize, height, squareSize], center=true);
}
}
}
}
width=5.05*inch;
height=3*inch;
depth=2*inch;
wallThickness=3;
patternMargin=0.10*inch;
difference() {
cutBox([width, height, depth], wallThickness);
translate([0,-depth/2-.05, -inch/1.6]) {
intersection() {
cube([width-patternMargin*2-1.5, wallThickness, height-patternMargin*2-inch*1.5],
center=true);
rotate([0,45,0]) {
pattern([200, wallThickness+.05, 200], 10, 5);
}
}
}
}