scad/badge_test.scad

69 lines
1.2 KiB
OpenSCAD
Raw Normal View History

2024-11-25 23:40:27 +01:00
$fn=32;
LAYER_HEIGHT=1;
NAME="c6hex";
COLOR_BASE="#ffffff";
COLOR_LOGO="#7f7f7f";
COLOR_NAME="#7f7fff";
module name() {
translate([18, 4, 0]) text(NAME, font="Roboto:bold");
}
module logo() {
translate([10, 10])
scale([16, 16])
circle(d=1, $fn=6);
}
module name_outline() {
minkowski() {
name();
circle(r=2.5);
}
}
module logo_outline() {
minkowski() {
logo();
circle(r=2);
}
}
module outline() {
union() {
name_outline();
logo_outline();
}
}
module name_cutout() {
difference() {
outline();
name();
}
}
module logo_cutout() {
difference() {
name_cutout();
logo();
}
}
module name_cutout_plate() {
linear_extrude(height=LAYER_HEIGHT) name_cutout();
}
module logo_cutout_plate() {
linear_extrude(height=LAYER_HEIGHT) logo_cutout();
}
module name_base_plate() {
linear_extrude(height=LAYER_HEIGHT) outline();
}
color(COLOR_BASE) translate([0, 0, 3*LAYER_HEIGHT]) logo_cutout_plate();
color(COLOR_LOGO) translate([0, 0, 2*LAYER_HEIGHT]) name_cutout_plate();
color(COLOR_NAME) translate([0, 0, 1*LAYER_HEIGHT]) name_base_plate();
color(COLOR_BASE) translate([0, 0, 0*LAYER_HEIGHT]) name_base_plate();