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

GDL
About building parametric objects with GDL.
SOLVED!

Can I use Textblock within a for next?

JGoode
Expert

I have an array that I need to output but I need to be able to control the width of each line it outputs. I understand that you cannot have a duplicated textblock name but is there a way around this? I can almost achieve what I need with a basic text2 line but defining the width is important.

 

Any help is much appreciated.

Many thanks

ArchiCAD 23

Windows 10
1 ACCEPTED SOLUTION

Accepted Solutions
Solution

You need to have a number that adds 1 each next, then convert it to a string and make it part of the name, thus your name increases/changes each time.

View solution in original post

2 REPLIES 2
Solution

You need to have a number that adds 1 each next, then convert it to a string and make it part of the name, thus your name increases/changes each time.

A_ Smith
Expert
I used to simple text, not textblocks. Though i guess you can use this method with textblock too.
 
dim arr[iElement] ! for example it's an array you need to display
! i consider that each element in array is a string value (word)
! according to define text style, text has height stored in value 'textSize'

maxLength = 0.200 ! for ex. maximum lenght of row is 200 mm

rowLength = 0

for i=1 to iElement
   iLength = stw( arr[iElement] )*0.001*GLOB_SCALE
    rowLength = rowLength + iLength
    if rowLength > maxLength then
      add2 0, -textSize*GLOB_SCALE ! 'making' new line of text
      rowLength = iLength
   endif
   text2 0,0, arr[iElement] ! displaying current value of array
next i
​

In that case text will form uneven rows (different length).
AC 22, 24 | Win 10

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!