45 lines
1000 B
OpenSCAD
45 lines
1000 B
OpenSCAD
include <BOSL2/std.scad>
|
|
|
|
// Parameter for console overwrite
|
|
x = 30.0;
|
|
y = 30.0;
|
|
|
|
boxLid(x, y);
|
|
|
|
module boxLid(x, y) {
|
|
xInner = x - 10;
|
|
yInner = y - 10;
|
|
|
|
if (xInner >= 6 && yInner >= 6) {
|
|
difference() {
|
|
cube([ x, y, 2 ], false);
|
|
|
|
xSpace = 5 + (((xInner + 2) % 8) / 2);
|
|
xAmount = (((xInner + 2) - xSpace + 5) / 8);
|
|
ySpace = 5 + (((yInner + 2) % 8) / 2);
|
|
yAmount = (((yInner + 2) - ySpace + 5) / 8);
|
|
|
|
for (i = [0:xAmount - 1], j = [0:yAmount - 1]) translate([ xSpace + i * 8, ySpace + j * 8, -1 ]) cube([ 6, 6, 3.5 ], false);
|
|
}
|
|
} else cube([ x, y, 2 ], false);
|
|
|
|
sideCut(y);
|
|
|
|
translate([ x, 0, 0 ]) mirror([ 1, 0, 0 ]) sideCut(y);
|
|
}
|
|
|
|
module sideCut(y) {
|
|
difference() {
|
|
translate([0,0,2]) cube([3, 0.75 * y - 2.5,6.6], false);
|
|
|
|
translate([2.3,y/4+2,0.5]) rotate([-90,-90,0]) linear_extrude(0.5 * y) polygon(points=[
|
|
[-1,-1],
|
|
[-1,1],
|
|
[7, 1],
|
|
[5.1,-1]
|
|
]);
|
|
}
|
|
|
|
translate([0,0,2]) cube([1.4, y, 3.4], false);
|
|
}
|