Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Text height

STW(textString)/1000*GLOB_SCALE will give me the length of the TEXT2 box, I discovered after a bit of pain (as opposed to the the length taken by the characters).

Now in the vertical dimension,
(setFontSize*25.4/72)*GLOB_SCALE/1000
will give me the height of the character itself and I am trying to figure out what the height of the text box is.

Is there supposed to be any function, or constant (for every single font?), or is there some other GDL trick that will give me the height of the text box?
12 REPLIES 12
Anonymous
Not applicable
Ignacio,
I think you are referring to the request function
REQUEST (Height_of_style,name,height)
This is in the appendix Special Functions.
Thank you,
Peter Devlin
Anonymous
Not applicable
Ignacio wrote:
STW(textString)/1000*GLOB_SCALE will give me the length of the TEXT2 box, I discovered after a bit of pain (as opposed to the the length taken by the characters).

Now in the vertical dimension,
(setFontSize*25.4/72)*GLOB_SCALE/1000
will give me the height of the character itself and I am trying to figure out what the height of the text box is.

Is there supposed to be any function, or constant (for every single font?), or is there some other GDL trick that will give me the height of the text box?
Igancio,
This has also always been toublesome for me as well. I notice that you are dividing by "72" presumably to convert to "points". Archicad's default to mm has always confused me. I hope some in the forum can shed some light on the best ways ro handle font sizes by points vs. mm...There just isn't any common standard that i have ever seen.

Thanks,
Dan K
Frank Beister
Moderator
Text in plans have been measured always in mm (in DE, of course).

Ignacio,
try the additional requestable values of "REQUEST (Height_of_style,...". There are 2 new since 8.0

Try also:

REQUEST ("Style_info",...

and

REQUEST ("TEXTBLOCK_INFO", ...

Frank
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Thank you *very* much Peter and Frank. I was not seeing the way out.

Frank:
American users know what a 12 or a 9 point is; the only practical result of translating the interface to 4 mm vs 3 mm would be an obscene waste of time and headaches for the user; while translating the interface for the font size to American draftman's inches would be headaches for me (since a dimension parameter will show a 1/8" font as an ugly 0'-1/8", the interface would need to use real numbers or text VALUES to represent inches). Points are goood. (I don't know where it is that one sets it, but my Text tool is dimensioned in points.)

Dan:
- The font 'point' is 1/72 of an inch.
- An inch is 25.4 mm.
- GDL sets font size in paper size, that is regardless of the drawing plan scale, so that a 3 mm text will print as 3 mm text no matter what scale you are using for your drawing. So that if you want to know the equivalent 'model dimension' of your text, you need to multiply that by GLOB_SCALE (which is the model/drawing ratio; you can check in the Scale Settings in the ArchiCAD window, or if you are at say 1/8"=1' it is 8 parts in an inch *12 inches in a foot=96).
- ArchiCAD may display ft-in (even in the parameters in the Object settings), but GDL thinks m. It helps, and also helps in sowing confusion, that you can actually script ft-in values --but if you ask a script to PRINT its thoughts about a dimension parameter, you'll get meters/metres no matter what your dimension preferences are. Ft-in are an interface display thing: so once you GDL-calculated a dimension in meters, you don't want to try to convert that to ft-in by doing math in GDL unless you want to mess up everything beyond repair.

Soooo, if you are needing the model ft-in height of a font size expressed in points, you need to do
(fontSize/72*1")*GLOB_SCALE, which is easy to read in ft-in, or
(fontSize/72*0.0254)*GLOB_SCALE, which is what a metric guy would do, or
(fontSize/72*25.4)*GLOB_SCALE/1000, which is my temporarily preferred hybrid only because I am trying to learn to think ft-in and make it readable for a ft-in guy, but deep inside I am still metric (err, I am thinking that actually the second method may be the more readable for a ft-in guy, apart from making more arithmetical sense).

I have been metric all my life, and started working in ft-in about two years ago. Operations in ft-in are a mess by themselves, but when you add to that mm instead of m and 'paper scale' as opposed to model dimensions, oh boy. There are very good reasons for each of those complications of course. But it gets hard when you are trying to learn a new function from the Hungarian English manual, and can't keep track of what 'height' they are talking about at each point (text height or box height, paper scale or real dimensions, text mm or GDL m, which of the damned eight height values are we talking now? Once you've learned the functions you don't have that problem any more --you only have it when you are learning, which is when you happen to need to use the manual).
Frank Beister
Moderator
AFAIK is the length of typeset-points 0.23mm. A lot of years ago (word 2.0 or so.) I proofed this by measuring and it was this unit.
but if you ask a script to PRINT its thoughts about a dimension parameter, you'll get meters/metres no matter what your dimension preferences are.
Are you familar wih the REQUEST commands? There are several REQUESTs to get the format of the unit-settings, part of the preferences in option menu.Since 8.0 you can ask for the units of the dialog boxes too. The return value is a string, which you can use directly in the STR-command:
format = ""
zahl = 60.55
dimension="Linear_dimension"
sts = REQUEST (dimension, "",format)
TEXT2 0, 0, dimension + " [" + format +"] " + STR (format, zahl)
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
F. wrote:
but if you ask a script to PRINT its thoughts about a dimension parameter, you'll get meters/metres no matter what your dimension preferences are.
Are you familar wih the REQUEST commands?
Today I am working on the same type of problem, and I guess the only way out is scripting the math, which is not rocket science but is not fun (on the positive side, I will re-use that a lot): this object distributes thingies at a regular interval, the interval determined by the script, and I need it to have a TEXT2 saying 'One thingy every 1 3/8" '

1 3/8" is a dimension rounded to an eighth of an inch (the true dimension may be say 1 13/32", whatever). So that depending on the dimension the text may end up giving full inches, halfs, quarters, or eighths.

In the metric world, I would just use STR and state the dimension with so many decimals. In the feet-and-inch world I need to do the math in the script and convert that into a string. The REQUEST you are talking about will let me know that the user has set such and such unit for displaying linear dimensions, but this is a totally different story (this should display 1 3/8" whatever the user is using for linear dimensions). While I can use feet-inches for scripting input values (HOTSPOT2 3/4", 2"-6") I have no command in GDL that will allow me to say "calculate this dimension and give me the result in feet and fractional inches to an eighth", right?
Anonymous
Not applicable
Ignacio,
I may have completely misunderstood your question but
can't you use the second form of the STR() function to do
what you want ?
Peter Devlin
Peter wrote:
Ignacio,
I may have completely misunderstood your question but
can't you use the second form of the STR() function to do
what you want ?
Peter Devlin
Ooops! I had completely missed that second form. I just looked it up and it seems like it does exactly that, or almost exactly that. Great. Thanks.
Frank Beister
Moderator
You cann add a exta_accuracy_string to the STR{2} command, but it will round only in the metric. You will have to do math again. 😉
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm