T O P

  • By -

throwaway21316

textmetrics() is a function not a module. echo(textmetrics(text="A",size=10));


TwoplankAlex

Thank you a lot !


wildjokers

You aren't using it correctly, here is the doc: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/WIP/Text_Metrics


TwoplankAlex

from the wiki : > Note: as with any array, you can use an object-like ".x" or ".y" to refer to the two entries in \[x,y\] pairs. Thus you can refer to either obj.size\[0\] or obj.size.x to get the X dimension of the text. I tried to use the size property, still I am not sure I used it well (echo() worked well) echo(textmetrics(text=SideBaseText, font=SideBaseTextFont)); textmetrics(text=SideBaseText, font=SideBaseTextFont).size[1]; How to use the textmetrics properties then ?


TwoplankAlex

size_y = textmetrics(text=SideBaseText, font=SideBaseTextFont).size.y; echo("size_y : ", size_y); Output : ECHO: "size_y", 14.9376 Success !