Does anyone know how to determine the
length of a text object at run time (i.e., report its value
with an echo command)?
Do you mean length as in the number of characters, or length as in
the width of the resulting object?
If you mean the number of characters, the len( ) function does the
If you mean the width... no, though there is a feature that might
let you avoid needing to know.ï¿½ If you need to center the text
object against something else, or you need to align its right end
rather than its left end, you can use the "halign" parameter of the
text( ) function to specify where the 0,0 point of the object is.ï¿½
Similarly, though you don't ask about it, the valign parameter will
let you specify vertical alignment.
Before you find a better solution, here is an ugly code that I came up with
years ago. I don't like it but it's the only thing I can find now. Check out
this <https://github.com/runsun/OpenSCAD_Tips/blob/master/snippets.md> for
the *hash()* and you also need to make a *sum(...)*. The *isnum()* is:
<code>floor(x)==x? true:( abs(x)+1>abs(x))</code>.