135 lines
2.9 KiB
OpenSCAD
135 lines
2.9 KiB
OpenSCAD
// * c l b w
|
|
only = "w";
|
|
|
|
color = "Red";
|
|
sku = "40200";
|
|
type = "ABS";
|
|
manuf = "Bambu";
|
|
top = "Ironed";
|
|
bottom = "Engineering";
|
|
|
|
layer_height = 0.12;
|
|
nozzle = 0.2;
|
|
|
|
card_height = 3;
|
|
swatches = 10;
|
|
swatch_width = 10;
|
|
swatch_height = 10;
|
|
|
|
e = 0.02;
|
|
|
|
card_width = swatches * swatch_width;
|
|
|
|
if (only == "*" || only == "c") {
|
|
difference() {
|
|
color("blue", alpha=0.3)
|
|
card();
|
|
label();
|
|
}
|
|
}
|
|
|
|
if (only == "*" || only == "l") {
|
|
color("magenta")
|
|
label();
|
|
}
|
|
|
|
if (only == "*" || only == "b") {
|
|
black();
|
|
}
|
|
|
|
if (only == "*" || only == "w") {
|
|
white();
|
|
}
|
|
|
|
module label() {
|
|
translate([0, 0, 2])
|
|
_label(top);
|
|
|
|
translate([card_width, 0, 1])
|
|
rotate([0, 180, 0])
|
|
_label(bottom);
|
|
}
|
|
|
|
module _label(surface) {
|
|
l1 = 48;
|
|
l2 = 41;
|
|
l3 = 34;
|
|
|
|
l = card_width * 12 / 64;
|
|
c = card_width / 2;
|
|
r = card_width * 52 / 64;
|
|
|
|
translate([c, l1, 0])
|
|
linear_extrude(1.01)
|
|
text(text=color, size=5, font="JetBrains Mono:style=Medium", halign="center");
|
|
|
|
translate([l, l2, 0])
|
|
linear_extrude(1.01)
|
|
text(text=manuf, size=4, font="JetBrains Mono:style=Medium", halign="center");
|
|
|
|
translate([c, l2 - 0.25, 0])
|
|
linear_extrude(1.01)
|
|
text(text=type, size=4, font="JetBrains Mono:style=Medium", halign="center");
|
|
|
|
translate([r, l2, 0])
|
|
linear_extrude(1.01)
|
|
text(text=sku, size=4, font="JetBrains Mono:style=Medium", halign="center");
|
|
|
|
translate([l, l3, 0])
|
|
linear_extrude(1.01)
|
|
text(text=str("L ", layer_height), size=4, font="JetBrains Mono:style=Medium", halign="center");
|
|
|
|
translate([c, l3, 0])
|
|
linear_extrude(1.01)
|
|
text(text=surface, size=4, font="JetBrains Mono:style=Medium", halign="center");
|
|
|
|
translate([r, l3, 0])
|
|
linear_extrude(1.01)
|
|
text(text=str("N ", nozzle), size=4, font="JetBrains Mono:style=Medium", halign="center");
|
|
}
|
|
|
|
module card() {
|
|
difference() {
|
|
hull() {
|
|
for (x = [0, card_width]) {
|
|
for (y = [0, 55]) {
|
|
translate([x, y, 0])
|
|
cylinder(h=card_height, d=4, $fn=100);
|
|
}
|
|
}
|
|
}
|
|
|
|
translucent();
|
|
white();
|
|
black();
|
|
}
|
|
}
|
|
|
|
module black() {
|
|
color("black")
|
|
stack();
|
|
}
|
|
|
|
module white() {
|
|
translate([0, swatch_height, 0])
|
|
color("white")
|
|
stack();
|
|
}
|
|
|
|
module translucent() {
|
|
translate([0, swatch_height * 2 + (nozzle * 2), 0])
|
|
for (i = [0:swatches-1]) {
|
|
translate([swatch_width * i, 0, 0])
|
|
translate([0, 0, (i + 1) * layer_height])
|
|
cube([swatch_width, swatch_height, card_height - (i * layer_height)]);
|
|
}
|
|
}
|
|
|
|
module stack() {
|
|
for (i = [0:swatches-1]) {
|
|
translate([swatch_width * i, 0, 0])
|
|
color("black")
|
|
translate([0, 0, e + (swatches - i) * layer_height])
|
|
cube([swatch_width, swatch_height, card_height - e - ((swatches + 1) * layer_height)]);
|
|
}
|
|
} |