License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
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!