Draft Angle on Embossed Text

I'd trying to make a form in OpenSCAD for casting a metal address plaque. Part of the plaque needs to contain embossed text, the house number, with a slight draft angle to allow the form to be removed from the casting sand. That is, the top of the text needs to be slightly smaller than the bottom.

I thought I could just use linear_extrude with a scale value slightly smaller than 1.0 to achieve this but I'm running into issues. The scale value tapers the entire text string toward the middle. The text on the left is tapered to the right and the text on the right is tapered towards the left.

Minimal Example:

linear_extrude( height=10, scale = .8) 
    text("X", 
         size=50,
         halign = "center",
         valign = "center");

translate([0, 100, 0])
    linear_extrude( height=10, scale = .8 ) 
        text("X X", 
         size=50,
         halign = "center",
         valign = "center");

Output

Is there any way to linear_extrude each character with a scale? Is this even the correct work flow?

Posted Jun 3, 2021, 5:34 AM UTC

48
OutwardBuckle•

I'm interested in seeing other answers, but one quick and dirty way you could do it is draw the text multiple times using offset each time. Something like this:

for (i=[0:0.01:0.4]){
    translate([0,0,i]) linear_extrude(0.01) offset(-i) text("Hi");
}
1
thm•

your offset method works really well

// font geometry gets complex very quickly if $fa is too low, wich slows down the render process massively
$fa=4;
$fs=.2;


module taperedtext(
	text, height, angle,
	size=undef, vcenter=false, halign=undef, valign=undef, spacing=undef, font=undef, direction=undef, language=undef, script=undef){
		
	tanA=tan(angle);

	for(i=[0:$fs:height-$fs]){
//		echo(i=i, delta=-tanA*i);
		translate([0, 0, i])
			linear_extrude($fs)
				offset(delta=-tanA*i)
					text(text=text, size=size, halign=halign, valign=valign, spacing=spacing, font=font, direction=direction, language=language, script=script);
	}
}


taperedtext("SCAD AVE", height=2, angle=5, size=5, font="DejaVu Sans Narrow:style=bold", halign="center");
translate([0,-22,0])
	taperedtext("69", height=2, angle=5, size=20, font="DejaVu Sans:style=bold", halign="center");

//edit: fixed the translate step height
//edit: and the angle calc

2
OutwardBuckle•

Looks good. Now we just need to merge this in with the multi-line code and we'll have one sexy-texty-module :)

Edit: Here-

$fa=4;
$fs=.2;

module taperedtext(
	text, height, angle,
	size=undef, vcenter=false, halign=undef, valign=undef, spacing=undef, font=undef, direction=undef, language=undef, script=undef){
		
	tanA=tan(angle);

	for(i=[0:$fs:height-$fs]){
//		echo(i=i, delta=-tanA*i);
		translate([0, 0, i])
			linear_extrude($fs)
				offset(delta=-tanA*i)
					text(text=text, size=size, halign=halign, valign=valign, spacing=spacing, font=font, direction=direction, language=language, script=script);
	}
}


module tapered_multiline_text(text, height=2, angle=0, lineheight=1.2, size=10, vcenter=false, halign=undef, valign=undef, spacing=undef, font=undef, direction=undef, language=undef, script=undef){
	translate((vcenter==true?1:0) * [0,-(len(text)-1)*size*lineheight/2,0])
		for(i = [ 0 : len(text)-1 ]){
			translate([0, (len(text)-1-i)*size*lineheight, 0])
			taperedtext(text=text[i], height=height, angle=angle, size=size, halign=halign, valign=valign, spacing=spacing, font=font, direction=direction, language=language, script=script);
		}
}


//txt=[ for(i=[0:5]) str(i) ];
//tapered_multiline_text(txt, height=2, angle=10, halign="center", valign="center", vcenter=true);

txt01=["Hi",
	"there",
	"Here",
	"is",
	"some",
	"text"];

tapered_multiline_text(txt01, height=2, angle=6, halign="center", valign="center", vcenter=true);
1
thm•

oh god. how many hours does that take to render?

1
OutwardBuckle•

I didn't try, the preview is quick enough to play around with but yeah, I wouldn't want to actually use this in anything

1
OutwardBuckle•

Just came across this - https://www.thingiverse.com/thing:3094095

Looks like it'll do what you want

1
flyingfoxOP•

Oh, that might be it. I'll have to check when I get home from work.

1
[deleted]•

[removed]

1