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

GDL
About building parametric objects with GDL.
SOLVED!

GDL Code Max Line Length

GDL Enthusiast
Enthusiast

Hi GDL Experts,

 

When I enter a line of code, I know the system limit is set to 120 characters. However when I enter code beyond this, it still seems to pick it up. For instance with the following text, it is 256 characters in length:

 

TEXT2 0, 0, "A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789S123456789T123456789U123456789V123456789W123456789X123456789Y1"

 

On windows, the GDL code converts that to a workable function, at 257 characters it produces an error saying that the limit is 256.

 

With wide screens, it can sometimes be handy to make use of the full line e.g. when using the call function with a lot of parameters. But I wonder if there are any issues with Mac or other operating systems?

 

Is there any reason that one may not code to the full extent of 256 characters when needed or are there some hidden problems that crop up? 

 

Thank you so much in advance!

2 ACCEPTED SOLUTIONS

Accepted Solutions
Solution
Ralph Wessel
Mentor

GDL string parameters are limited to 255 bytes. I'm guessing probably strings in general are limited to 255 bytes in GDL. Note that this is the byte limit - if you use multi-byte characters, the character count accepted in a string will be lower

Ralph Wessel BArch
Software Engineer Speckle Systems

View solution in original post

Solution
Peter Baksa
Graphisoft
Graphisoft

Hi,

 

The 120 character maximum line length written in the style guide is just a recommendation, not a limit of GDL. When one uses some source control tool and compares different file versions, it is useful on wide screens too.

 

A frequent exception is editable hotspots which are more readable in three long lines, with the coordinates aligned in columns.

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

View solution in original post

8 REPLIES 8
Nader Belal
Mentor

Don't get in that area.

 

Just break you line in smaller chunks and put them one beside the other 

A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.
Solution
Ralph Wessel
Mentor

GDL string parameters are limited to 255 bytes. I'm guessing probably strings in general are limited to 255 bytes in GDL. Note that this is the byte limit - if you use multi-byte characters, the character count accepted in a string will be lower

Ralph Wessel BArch
Software Engineer Speckle Systems

Hi Ralph, thanks so much for responding. That is a bit of background which helps me understand this better. Does it matter as long as one stays under the 255 byte limit even with multi-byte characters? I mostly keep my coding pretty tight in line length. It is helpful for my understanding of reliability when used on other systems.

 

Essentially, from what I understand 120 is the multi-byte limit and 255 is the byte limit. So one could theoretically code to the full 255 byte limit and the GDL would still work on all systems (in theory). Is that correct? Thank you so much!

Hi Nader, thank you, you are spot on as always. I have found here and in other articles to keep the coding tight. It was more a question around the practical limits and what falls over if one ups the code length for my understanding. I was pondering what would happen and the effects of longer code length (wide screens have a lot to answer for lol)...

Solution
Peter Baksa
Graphisoft
Graphisoft

Hi,

 

The 120 character maximum line length written in the style guide is just a recommendation, not a limit of GDL. When one uses some source control tool and compares different file versions, it is useful on wide screens too.

 

A frequent exception is editable hotspots which are more readable in three long lines, with the coordinates aligned in columns.

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

I think we're splitting into 2 subjects here. While the recommended line length for GDL is 120 chars, that isn't the same as the max length of a string parameter. It's possible to make lines that are far longer, but (unless something has changed very recently) you will never get a single string parameter to hold more than 255 bytes.

 

For API development, for example, I've had to explicitly divide up strings to be store in GDL parameters when they are longer than 255 bytes.

Ralph Wessel BArch
Software Engineer Speckle Systems

Hi Peter, that makes good sense and helps me understand it better, especially now the style guide being a recommendation, not a limit of GDL. 

 

Thank you for your guidance!

Thanks Ralph for the explanation about length and the practical coding limits you apply in your APL development. It really helps me get a better grasp of the limits of GDL. APL coding is long term dream for me, seems like it would be a lot of fun but super hard to learn. 

 

Wishing you all the best!