Files

136 lines
2.7 KiB
OpenSCAD

only = "*";
color = "Black";
sku = "FibreX";
type = "ABS+GF";
manuf = "3DXTECH";
layer_height = 0.1;
swatches = 8;
swatch_width = 10;
card_width = swatches * swatch_width;
if (only == "*" || only == "c") {
difference() {
color("blue")
card();
label();
}
}
if (only == "*" || only == "l") {
color("magenta")
label();
}
if (only == "*" || only == "b") {
difference() {
translate([0, 0, 0])
cube([card_width, 15, 3]);
black();
}
}
if (only == "*" || only == "w") {
difference() {
translate([0, 15, 0])
cube([card_width, 15, 3]);
white();
}
}
if (only == "b2") {
black();
}
if (only == "w2") {
white();
}
module label() {
translate([0, 0, 2])
_label();
translate([card_width, 0, 1])
rotate([0, 180, 0])
_label();
}
module _label() {
translate([card_width / 2, 48, 0])
linear_extrude(1.01)
text(text=color, size=5, font="JetBrains Mono:style=Medium", halign="center");
translate([card_width * 12 / 64, 41, 0])
linear_extrude(1.01)
text(text=manuf, size=3.5, font="JetBrains Mono:style=Medium", halign="center");
translate([card_width * 52 / 64, 41, 0])
linear_extrude(1.01)
text(text=sku, size=3.5, font="JetBrains Mono:style=Medium", halign="center");
translate([card_width / 2, 40.75, 0])
linear_extrude(1.01)
text(text=type, size=4, font="JetBrains Mono:style=Medium", halign="center");
for (i = [0:swatches-1]) {
t = str(layer_height * (i+1));
translate([5 + (i * swatch_width), 33, 0])
linear_extrude(1.01)
text(text=str(t[1], t[2]), size=2.5, font="JetBrains Mono:style=Medium", halign="center");
}
}
module card() {
difference() {
hull() {
cube([card_width, 55, 3]);
for (x = [0, card_width]) {
for (y = [0, 55]) {
translate([x, y, 0])
cylinder(h=3, d=4, $fn=100);
}
}
}
translate([0, 0, -0.01])
cube([card_width, 15, 3.02]);
translate([0, 15, -0.01])
cube([card_width, 15, 3.01]);
}
black();
white();
}
module black() {
translate([0, 0, 3.0])
stack();
translate([card_width, 0, 0])
rotate([0, 180, 0])
stack();
}
module white() {
translate([0, 15, 3])
stack();
translate([card_width, 15, 0])
rotate([0, 180, 0])
stack();
}
module stack() {
for (i = [0:swatches]) {
color("teal", alpha=0.3)
translate([swatch_width * i, 0, 0 - ((i+1) * layer_height)])
cube([swatch_width * (swatches - i), 15, layer_height]);
}
}