We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

Word wrapping

Paul King
Mentor
Hi - I am wondering how to implement good word wrapping in a text string with a proportional rather than fixed width font?

Cheers
PAUL KING | https://www.prime.net.nz
ArchiCAD 8-28 | Twinmotion 2024
Windoze 11 PC | Intel Core i9 10900K | Nvidia Gforce RTX 3080 | 32 Gb DDR3 | 2x4K monitor extended desktop
4 REPLIES 4
Anonymous
Not applicable
Paul

I have used the STW() command to do word wrapping:

As each word is chopped off the main text string one at a time it is then added to the string for the current line.

The words are found by hunting for the first space in the main text string;

word_length = strstr(input_line," ")
let current_line = current_line + strsub(input_line,0,word_length)

The actual placed width of the current line string is checked with the STW() command (which allows for the current font)

STW(current_line)/1000*GLOB_SCALE <= line_width

When the width is exceeded the script then has to go back a step to place the string without the extra word and then carries on with the next line....

One extra note, as variables in GDL are limited to 256 characters that is the maximum single line length that you can process and wrap, effectively limiting the length a paragraph.


hope this give you some ideas

regards
Paul King
Mentor
Hi Bill - thanks for that - I stumbled on the STW() command late last night & figured it would be the way to go. Good to get your tips on algorythm for wrapping.

BTW, have otherwise created that auto text note object I mentioned to you the other day - and it does works with calculate menu when placed in plan or section!
Am going to use the new hotspot feature to set dynamic note text wrapping now. Good fun!

One more question to do with calulate menu:

How to you generate a list with word wrapping enabled in a feild (I can definitlly do that much) AND have dynamic display feild height to suit of rows generated as a result of wrapping
- ie avoiding unnecesary white space in list?

Failing that, is there a way a library part can detect and count & list other library parts in a view or selection set ?

Can the Calculate menu be used to do the detecting & counting, and sent the result back to a placed library part for listing?

Cheers
PAUL KING | https://www.prime.net.nz
ArchiCAD 8-28 | Twinmotion 2024
Windoze 11 PC | Intel Core i9 10900K | Nvidia Gforce RTX 3080 | 32 Gb DDR3 | 2x4K monitor extended desktop
Anonymous
Not applicable
I found this and I am struggling a little. I want to add the ability for the user to select which break puts the text on the 2nd line.

string = "A/V SYSTEM VIDEO"
len = STRLEN (string)
n = STRSTR (string, " ")
n2 = STRSTR (string, " ")
TEXT2 0, -1, STRSUB (string, 1, n2 - 1)
TEXT2 0, -2, STRSUB (string, n2 + 1, len)

Prints "AV"
"SYSTEM VIDEO"

I want the option to choose between that and


"AV SYSTEM"
"Video"

Also was wondering if you could use the STW command with hot spots to make a box that acts like the text tool

Thanks
Frank Beister
Moderator
Wich ArchiCAD Version? From AC8+ you should use RICHTEXT2.

There is no command to search the second instance of a character inside a string. You have to devide it for the second search:

n = STRSTR (string, " ")
n2 = n+ STRSTR (STRSUB(string,n+1,len-n), " ")
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

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!