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.

Brand Spanking New GDL Book

Aaron Bourgoin
Virtuoso
Cadimage Tools scripting wizards have written a big book on GDL - to be published shortly.

http://blog.cadimagetools.com/
Think Like a Spec Writer
AC4.55 through 27 / USA AC27-6000 USA
Rhino 8 Mac
MacOS 14.6.1
106 REPLIES 106
Anonymous
Not applicable
A reader pointed out that the page numbers on the example files don't align correctly with the printed book (thanks Lec!). Most of them are 2 pages out.

I've now re-named all the example files. They can be downloaded as per the original instructions. You should delete the original files, and use the new files instead.

One other change is that they are now in a simple folder structure rather than an LCF file. This should make it easier to browse for a .gsm file using the ArchiCAD File > Libraries and Objects > Open Object menu.
Anonymous
Not applicable
ok great, i'll download those now.
Anonymous
Not applicable
Don't forget, like I did, that you still need the password on the addendum
sheet that came with your book to extract the zip to the folder of your choice.
I've now written that password in my book in case other add-on's/sources become available.
Anonymous
Not applicable
thanks, that is a good idea. I had it emailed to me. So it's nice and safe somewhere in my inbox
Anonymous
Not applicable
Just a note regarding any errors that may appear in the text.

There are one or two errors here and there, things such as page formatting, grammar and syntax. Any errors in the GDL code are 'ironed out' in the downloadable examples.

As I find errors in the text that could possibly contribute to confusion or misinformation, I'll list them on the Cadimage Tools forum, together with a corrected version.
Anonymous
Not applicable
Did not understand everything up to here(pg53), but got most of the general ideas for later use I think, but now.

Having a bit of fun on page 54.
excerpt-1:
!Get the current date and time as formatted strings
rrrr = request("DateTime", "%x", currentDateStandard)
rr = request("DateTime", "%A %d/%m/%Y", currentDateCustom)
rr = request("DateTime", "%X", currentTimeStandard)
r= request("DateTime", "%H:%M:%S", currentTime24Hour)
I noticed that even if I modified the rrr to rrrr it did not change the output.
Then cut r's to rr then r, and still no apparent change to outputs.
However, when I deleted the remaining r, script of course failed "unnecessary token at line 12"
So my question is why all the r's if only one is necessary?
Why use the word token?
Must be missing the bigger picture?

Then in script that organizes the output, excerpt-2:
Display the formatted dates and times
text2 0, 0, currentDateStandard
text2 0, -lineSpacing, currentDateCustom
text2 0, -2*lineSpacing, currentTimeStandard
text2 0, -3*lineSpacing, currentTime24Hour
!Mine text2 0, -4*lineSpacing, currentDateStandard

As you can see, I added one more output call and it worked ok adding one more instance of datestandard.
So it sort of seems like in this particular script the "parameters" are the except I listed in first of my excerpts and the script is my excerpt two.
And the real parameters are left essentially blank.
Is there a reason that date/time stamps are not called out in the standard
parameter window?
Thanks!
Anonymous
Not applicable
Hi Lec,

The rrr value is simply a return value for the request. If the request is successful, I believe the number 1 is returned in this variable. I didn't focus on this variable in the book, as generally you can rely on the data being returned from this function and so can pretty much ignore the variable.

The 'important' data is returned in the variable inside the brackets (eg. dateStandard). The request sets the value of this variable, so you can then use it in the following lines of script.

Why it works this way, I can't say, but it's consistent with other requests. There are one or two ways of getting useful information for use in GDL scripts, including requests, global variables and data from add-ons.
Laszlo Nagy
Community Admin
Community Admin
Andrew wrote:
Hi Lec,

The rrr value is simply a return value for the request. If the request is successful, I believe the number 1 is returned in this variable. I didn't focus on this variable in the book, as generally you can rely on the data being returned from this function and so can pretty much ignore the variable.
From page 250 of the GDL Reference Guide:
The function’s return value is the number of the answer (in the case of a badly formulated question or a nonexisting name, the value will be 0).
So, for example, the below REQUEST function:
rrr = REQUEST ("Story", "", index, story_name)
should set the variable rrr to the value of 2 because it returns 2 values: the story index number and the story name string.
But in case of the examples Andrew showed it should return 1.

You can check the value of rrr after the command because if it returns 0 then you know there was a problem. Good for debugging.
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac27
Anonymous
Not applicable
Thanks Andrew and Laszlo

I think I get what you both are saying, which is really the same, just said in different ways.
However, I know it’s not really important, but I would like to know why it did not seem to mater when I altered the rrr “request” from 3 r’s to 4 or down to one r.
When I ran the script it seemed to respond the same.
Just curious I guess if there is an easy answer.
Are there a lot more (no need to be exact call outs) in gdl?
It just might help me cement this in my head a bit.
Anonymous
Not applicable
Using the variable rrr to take the return value of a request is just a habit I've fallen into. You could use any variable name you like, for example nReturnedValues would make more sense.

The following lines of script don't use the value of rrr, so you can happily change the variable to rr or just r if you prefer.