tray = {
const { drawRect } = drawShape;
function basicTray(width, height, depth, { paperThickness = 0.1 } = {}) {
const backSide = new Dieline(
drawRect(width - 2 * paperThickness, depth).translateY(depth / 2)
)
.fuseFold(
drawFlaps
.top(width, depth, {
contraction: 3 * paperThickness,
fillet: 0
})
.translateY(depth)
)
.translateY(height / 2);
const bumpWidth = Math.min(10, width / 5);
const bump = new FoldBump(bumpWidth, paperThickness).translateY(height / 2);
const bumps = [
bump,
bump.translateX((-3 * width) / 8),
bump.translateX((3 * width) / 8)
];
bumps.forEach((bump) => bump.translateY(2 * depth).fuseBump(backSide));
const innerFlapHeight = Math.min(2 * depth, width / 2 - 1);
const leftSide = new Dieline(drawRect(depth, height))
.fuseFold(
drawFlaps
.top(depth, innerFlapHeight, {
contractionLeft: 2 * paperThickness
})
.translateY(height / 2)
)
.fuseFold(
drawFlaps
.bottom(depth, innerFlapHeight, {
contractionLeft: 2 * paperThickness
})
.translateY(-height / 2)
)
.translateX(-width / 2 - depth / 2);
const shape = new Dieline(drawRect(width, height))
.fuseFold(backSide)
.fuseFold(backSide.mirror("x"))
.fuseFold(leftSide)
.fuseFold(leftSide.mirror("y"));
bumps.forEach((bump) => {
bump.makeCut(shape);
bump.mirror("x").makeCut(shape);
});
return shape;
}
return showSVG(
basicTray(params.width, params.height, params.depth, {
paperThickness: 0.2
})
);
}