Learn to manage BIM workflows and create professional Archicad templates with the BIM Manager Program.

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

Text treatment in GDL

Anonymous
Not applicable
(I thought I saw something regarding this, but I just can't find it. It if's been discussed, just point me in the right direction.)

I'm trying to create a block with multiple lines of text, and I wouldn't always need all the lines of text to show all the time. One option that I thought I saw here, was to move the second line of text down by the height of the text (i.e.: if the text is 5mm high, the second line would start 6mm below it). I just can't remember how you can pull (REQUEST?) that information out.

Alternately, is there a line-feed option that I'm not aware of?

Thanx
8 REPLIES 8
Anonymous
Not applicable
The text height is in your style definition. I often use a variable for this like text_sz so I can call it later in situations like yours.

There is no linefeed function. You have to insert lines of text with separate TEXT2 statements. I have set up parts to word wrap to a variable column width, but this requires parsing the strings and assigning each line of text to a separate variable. This is not a job for the faint of heart or short of time.
Anonymous
Not applicable
I also use a text size variable, however, how would you figure out where to place the next line of text? For example:
text_size = 5 !-- this is usually in mm, right?
TEXT 0", 0", "first line of text here"
TEXT 0", Y, "second line of text here"
How would you figure out what 'Y' should be if you're working in the english system? You can't just do Y = 0-text_size, can you?
Anonymous
Not applicable
Sergio wrote:
I also use a text size variable, however, how would you figure out where to place the next line of text? For example:
text_size = 5 !-- this is usually in mm, right?
TEXT 0", 0", "first line of text here"
TEXT 0", Y, "second line of text here"
How would you figure out what 'Y' should be if you're working in the english system? You can't just do Y = 0-text_size, can you?
Sure. An example:
text_sz   = 8 * 0.3528                         ! conversion from points to mm

DEFINE STYLE "text_style" "Arial", text_sz, 1, 0

STYLE text_style

TEXT2 0, 0, "First line of text"                ! or a variable parameter
TEXT2 0, -text_sz*1.25, "Second line of text"   ! or whatever 
Anonymous
Not applicable
Huh? Did I mention I'm on the english system (the one with feet and inches)? I just tried your solution, and I'm still getting some weird spacing. My temporary solution is like so:
t_lines=0
t_conv=0.08
a2 = a

IF s_dim = 1 THEN !--- show Dimmer ---
	dim_a = a2: dim_b = b+(t_lines*t_size*t_conv)
	hotspot2 dim_a, dim_b, 2	!drag text to location
	TEXT2 dim_a, dim_b, 'D'
	t_lines = t_lines +1
ENDIF
I'll probably take another look at it some other time... unless you have some other ideas. Maybe I'm just not seeing it (wouldn't be the first time).
Anonymous
Not applicable
Sorry, I forgot one important thing. The text size is mm in paper space but the TEXT2 position parameters assume meters in model space (like all of GDL internally), so the line should read:
TEXT2 0, -text_sz*A_*0.00125, "Second line of text"
When you say you are using imperial/english/american, I am assuming that means you are using point sizes for type.

In any case, GDL is all metric internally but you can always put in the arithmetic to do the conversion. When you type in the foot-inch format in GDL scripts it is converted for you.

I honestly don't understand what you are trying to accomplish with the code you posted. It looks a bit complicated if all you are trying to do is place multiple lines of text.
Anonymous
Not applicable
Matthew wrote:
Sorry, I forgot one important thing...

Okay, much better now. Thank you very much...
I honestly don't understand what you are trying to accomplish with the code you posted. It looks a bit complicated if all you are trying to do is place multiple lines of text.

I was actually trying to create some blocks (switch, outlet, etc) that would need to have different parameters show up (height AFF, dimmer, 3W, etc). Sometimes you need to have more than one option showing, hence the need for a second line. Now if only I could figure out a way of having the option to position the hotlinks (and associated text) individually for all... Any ideas here?

As for the code, I'm not generally known for creating very clean code. It usually works, but at what price...
Aussie John
Newcomer
Matthew wrote:
There is no linefeed function. You have to insert lines of text with separate TEXT2 statements.
Matthew, you will be pleased to know you are incorrect

use +"\n" to make a new line of text

Example: text2 L,H,"max width "+x+" m"+"\n"+"max depth "+y+" m"+"\n"+area+" sq m"
Cheers John
John Hyland : ARINA : www.arina.biz
User ver 4 to 12 - Jumped to v22 - so many options and settings!!!
OSX 10.15.6 [Catalina] : Archicad 22 : 15" MacBook Pro 2019
[/size]
Anonymous
Not applicable
Aussie wrote:
Matthew wrote:
There is no linefeed function. You have to insert lines of text with separate TEXT2 statements.
Matthew, you will be pleased to know you are incorrect

use +"\n" to make a new line of text

Example: text2 L,H,"max width "+x+" m"+"\n"+"max depth "+y+" m"+"\n"+area+" sq m"
Cool. Thanks.