Files
BoardGameInlets/SmallWorld/Race-Box.scad

49 lines
1.1 KiB
OpenSCAD

include <BOSL2/std.scad>
use <../Color.scad>
use <../Box.scad>
raceBox(12, "Test", 8);
module raceBox(z, name, fontSize) {
raceBoxHelper(138, 53.5, z, name, fontSize);
nameHelper(138, z, name, fontSize);
}
module raceBoxHelper(x, y, z, name, fontSize) {
makeColor("yellow") difference() {
cuboid(
[ x, y, z],
anchor = [ -1, -1, -1 ],
rounding = 1,
edges = [
BOTTOM,
FRONT+LEFT,
FRONT+RIGHT,
BACK+LEFT,
BACK+RIGHT
]
);
translate([0, 0, z]) mirror([0, 0, 1]) sideCut(y); // left upper
translate([x, 0, z]) mirror([1, 0, 0]) mirror([0, 0, 1]) sideCut(y); // right upper
translate([ x / 2, 1, z / 2 ]) rotate([ 90, 0, 0 ]) linear_extrude(height = 1.1) text(
name,
size = fontSize,
font = "Arial:style=Bold",
halign="center",
valign="center"
);
}
}
module nameHelper(x, z, name, fontSize) {
makeColor("white") translate([ x / 2, 1, z / 2 ]) rotate([ 90, 0, 0 ]) linear_extrude(height = 0.2) text(
name,
size = fontSize,
font = "Arial:style=Bold",
halign="center",
valign="center"
);
}