I want to put relief text on curved surface but can't find way to do that in OpenSCAD. I'm aware it's possible to bend text in Blender and then import stl
, but I don't like this workflow. I found sort of working solution but it's not perfect.
$fn=50;
module bend_text(caption, angle, text_height, text_width, text_depth, steps=10, k=1) {
dh = text_height / steps;
r = text_height / (angle * PI / 180);
h0 = - text_height / 2;
translate([0, 0, -r])
rotate([angle / 2, 0, 0])
for(i=[0:steps-1]) {
rotate([-i * angle/steps, 0, 0])
translate([0, -(dh * i + h0), r / k])
intersection() {
linear_extrude(text_depth)
text(caption, valign="center", halign="center");
translate([0, dh * i + h0, 0])
cube([text_width, dh, text_width], center=true);
}
}
}
bend_text("test", angle=90, text_height=9, text_width=30, text_depth=1, steps=10, k=1.1);
Is there better way?
If a CAD question is related to 3D printing then it is on-topic. However, general CAD questions, unrelated to 3D printing, are not on-topic.
Very interesting question though! Mentioning that bending the text is required when text is projected onto small radii else there might be gaps under the letters that prevent proper printing. $\endgroup$