Added script

This commit is contained in:
William Miceli
2026-03-02 22:04:01 -05:00
commit fd0375304e

55
Nametag.scad Normal file
View File

@@ -0,0 +1,55 @@
/* [Text] */
// Text to be written
text_content = "William Miceli";
base_depth = 1;
text_depth = 0.5;
size = [100, 20];
corner_radius = 5;
border_width = 1;
text_height_as_pct_of_base_height = 0.6;
text_spacing = 0.95;
$fn = 100;
// Text
color("blue"){
translate(
[size[0]/2,
size[1]*((1-text_height_as_pct_of_base_height)/2),
base_depth]
)
linear_extrude(height=text_depth, center = false)
text(
text_content,
size[1]*text_height_as_pct_of_base_height,
"Arial:style=Regular",
halign="center",
valign="baseline",
spacing=text_spacing
);
}
// Border
color("blue"){
difference(){
translate([0,0,base_depth])
linear_extrude(height=text_depth, center = false)
roundedRect(size, radius=corner_radius);
translate([0,0,base_depth-1])
linear_extrude(height=text_depth+2, center = false)
offset(r=-border_width)
roundedRect(size, radius=corner_radius);
}
}
// Base
color("white"){
linear_extrude(height=base_depth, center = false)
roundedRect(size, radius=corner_radius);
}
module roundedRect(size, radius) {
offset(r=radius) offset(r=-radius) square(size);
}