// This a generator for box dividers of varying layouts // Author: Roland Grichnik (r.grichnik@googlemail.com) // Date of Creation: 2022-02-14 use <../laserSlot/laserSlot.scad> //Debug mode? debug = false; //Generator Mode generatorMode = "Mockup"; // [Mockup, Cut Pattern - All, Cut Pattern - Unique] //Laser kerf width to adjust for (set to 0.0 for no adjustment. laserKerf = 0.21; //Material thickness. materialThickness = 1.51; //Slot width as empirically determined for a good friction fit. slotWidth = 1.31; //Number of dividers in X (will yield one box more than dividers). nDividersX = 2; //Number of dividers in Y (will yield one box more than dividers). nDividersY = 3; //Total X-dimension (usually inside X measurement of box for divider). totalX = 100; //Total Y-dimension (usually inside Y measurement of box for divider). totalY = 150; //Total Z-dimension (usually heigth of box for dividers). totalZ = 40; //Calc: Spacing between divider center points. //TODO: This theoretically makes the outer boxes (which only have one limiting wall) a smidgeon larger, but that doesn't matter for now. spacingX = totalX/(nDividersY+1); spacingY = totalY/(nDividersX+1); slotPositionsX = [ for (x = [1 : nDividersY]) x*spacingX ]; echo(slotPositionsX); slotPositionsY = [ for (y = [1 : nDividersX]) y*spacingY ]; //Gap for cut layouts. layoutGap = 2; module mockup(){ //generate boards along X-direction for(x=[1:nDividersX]){ translate([0,x*spacingY,0]) rotate(0) board(length=totalX,slotPositions=slotPositionsX,isSlotOnTop=false,doubleSlotDebug=debug); } //generate boards along Y-direction for(y=[1:nDividersY]){ translate([y*spacingX,0,0]) rotate(90) board(length=totalY,slotPositions=slotPositionsY,isSlotOnTop=true,doubleSlotDebug=debug); } //generate mockup bounding box shape %cube([totalX,totalY,totalZ]); } //Generates a single, slotted board in X-direction. Thickness is centered around 0. With slots through half the material width in positions determined by the vector slotPositions. isSlotOnTop determines wheter slot is generated at the top or bottom of the board. module board(length=120,slotPositions=[30,60,90],isSlotOnTop=false,doubleSlotDebug=false){ module boardProfile(){ difference(){ square([length,totalZ]); for(i=[0:len(slotPositions)-1]) translate([slotPositions[i],0]) rotate(-90) slot(width=doubleSlotDebug?2*slotWidth:slotWidth,length=totalZ/2,chamferLength=0.5,chamferAngle=60,cornerCircleDiameter=0.5,flipX=isSlotOnTop?true:false); } } translate([0,+materialThickness/2,0]) rotate([90,0,0]) linear_extrude(height=materialThickness) boardProfile(); } module cutLayout(onePerType=false){ if(onePerType){ translate([0,0,0]){ translate([-layoutGap,0,0]) linear_extrude(height=materialThickness) text(str(nDividersX, "x"),halign="right",size=totalZ/2); rotate([-90,0,0]) board(length=totalX,slotPositions=slotPositionsX,isSlotOnTop=false,doubleSlotDebug=debug); } translate([0,totalZ+layoutGap,0]){ translate([-layoutGap,0,0]) linear_extrude(height=materialThickness) text(str(nDividersY, "x"),halign="right",size=totalZ/2); rotate([-90,0,0]) board(length=totalY,slotPositions=slotPositionsY,isSlotOnTop=true,doubleSlotDebug=debug); } } else { for(x=[1:nDividersX]){ translate([0,(x-1)*(totalZ+layoutGap),0]) rotate([-90,0,0]) board(length=totalX,slotPositions=slotPositionsX,isSlotOnTop=false,doubleSlotDebug=debug); } for(y=[1:nDividersY]){ translate([totalX+layoutGap,(y-1)*(totalZ+layoutGap),0]) rotate([-90,0,0]) board(length=totalY,slotPositions=slotPositionsY,isSlotOnTop=true,doubleSlotDebug=debug); } } } if(generatorMode=="Mockup") mockup(); else if(generatorMode=="Cut Pattern - All") offset(laserKerf/2) projection() cutLayout(onePerType=false); else if (generatorMode=="Cut Pattern - Unique") offset(laserKerf/2) projection() cutLayout(onePerType=true); //board(isSlotOnTop=true); //offset(laserKerf/2) projection() cutLayout(onePerType=true);