commit f65d7c226ff53951bbe0a3a1d9230e7279044767 Author: David Ashby Date: Sat Jan 8 14:01:13 2022 -0500 add recipebox diff --git a/recipebox.scad b/recipebox.scad new file mode 100644 index 0000000..068858c --- /dev/null +++ b/recipebox.scad @@ -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); + } + } + } +} \ No newline at end of file