Files
BoardGameInlets/CardHolder.scad

94 lines
2.1 KiB
OpenSCAD

include <BOSL2/std.scad>
// Parameter for console overwrite
x = 58;
y = 5;
z = 88;
name = "Cards";
cardHolder(x + 5, y + 3, z + 4, name);
module cardHolder(x, y, z, name) {
// floor
xInner = x - 10;
yInner = y - 10;
if (xInner >= 6 && yInner >= 6) {
difference() {
cube([ x, y, 1.5 ], 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, 1.5 ], false);
// left
translate([ 0, 0, 1.5 ]) cuboid(
[ 1.5, y, z - 1.5 ],
anchor = [ -1, -1, -1 ],
rounding = min(10, y - 1.5),
edges = FRONT + TOP
);
// right
translate([ x - 1.5, 0, 1.5 ]) cuboid(
[ 1.5, y, z - 1.5 ],
anchor = [ -1, -1, -1 ],
rounding = min(10, y - 1.5),
edges = FRONT + TOP
);
// back
translate([ 1.5, y - 1.5, 1.5 ]) {
cuboid(
[ 10, 1.5, z -1.5],
anchor = [ -1, -1, -1 ],
rounding = 5,
edges = RIGHT + TOP
);
translate([ x - 13, 0, 0 ]) cuboid(
[ 10, 1.5, z - 1.5 ],
anchor = [ -1, -1, -1 ],
rounding = 5,
edges = LEFT + TOP
);
translate([ 10, 0, 0 ]) difference() {
cube([ x - 23, 1.5, z - 1 ], false);
translate([ 0, -1, 15 ]) cuboid(
[ x - 23, 3, z - 12 ],
anchor = [ -1, -1, -1 ],
rounding = 10,
edges = [ LEFT + BOTTOM, RIGHT + BOTTOM ]
);
translate([ -1, -1, 35 ]) cube([ x - 21, 3, z - 20 ], false);
}
}
// front
translate([ 1, 0, 1 ]) {
difference() {
cuboid(
[ 10, 1.5, z - 21 ],
anchor = [ -1, -1, -1 ],
rounding = 5,
edges = RIGHT + TOP
);
translate([ 7.5, 0.4, 2.5 ]) rotate([ 0, -90, 90 ]) linear_extrude(height = 0.6) text(name, size = 5, font = "Arial:style=Bold");
}
translate([ x - 12, 0, 0 ]) cuboid(
[ 10, 1.5, z - 21 ],
anchor = [ -1, -1, -1 ],
rounding = 5,
edges = LEFT + TOP
);
}
}