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

Newbie Questions about GDL

Anonymous
Not applicable
I've recently had the good fortune of starting with a firm using ArchiCAD and was hoping the community could help me get my feet wet. I've worked through the tutorial but I haven't been able to find a few piece of information. So without further ado....

1) Why are the scripting categories such as the Master, 2D, 3D, etc. separated? I know the master script is interpreted first allowing locally global variables to be defined, however I'm uncertain as to how and when the other scripts are run. Are they triggered by events in the model or are they all run in a specific order?

2) How do I force an object to align with another object on placement? Windows and doors for example resist being placed in an empty part of the model - how do I get other objects to behave in a similar fashion for arbitrary objects?

3) Is their any meaningful way to collect variables into a container of some kind and refer to them collectively? So rather than having three variables for the x,y, and z coordinates can I have a single variable containing an array with three values attached and access them separately?

4) Is their any means of creating custom functions or is that behavior entirely handled through macros?

Thanks in advance for your assistance, I'm really looking forward to digging into the software!
2 REPLIES 2
ztaskai
Graphisoft Alumni
Graphisoft Alumni
Cleverbeans wrote:
1) Why are the scripting categories such as the Master, 2D, 3D, etc. separated? I know the master script is interpreted first allowing locally global variables to be defined, however I'm uncertain as to how and when the other scripts are run. Are they triggered by events in the model or are they all run in a specific order?
You can read about script types in section 'Script type specific issues' of GDL Technical Standards:
http://www.graphisoft.com/ftp/techsupport/documentation/developer_docs/BasicLibraryDoc/13/LibDevGuid...

(permalink to Basic Library Documentation: http://www.graphisoft.com/support/developer/documentation/LibraryDevKit/ )

Basically, each script is run when needed. F.ex. 2D script is run when the 2D look of the object has to be updated. This can be triggered by the first placement, changes in the parameters, changes in the view, etc. The trickiest script is definitely parameter script, you can find more info about that in the referred documentation and in earlier topics of this forum.
Cleverbeans wrote:
2) How do I force an object to align with another object on placement? Windows and doors for example resist being placed in an empty part of the model - how do I get other objects to behave in a similar fashion for arbitrary objects?
Unfortunately, you can't attach two independent objects in an intelligent way in ArchiCAD (other than wall openings and walls). You can align them while placing the second one using guide lines and various editing features of ArchiCAD and you can group them when their relative position is set. This is pretty much independent from GDL. From GDL on the other hand, you can script a group of elements (e.g. furniture layouts or other design aids) in one object.
Cleverbeans wrote:
3) Is their any meaningful way to collect variables into a container of some kind and refer to them collectively? So rather than having three variables for the x,y, and z coordinates can I have a single variable containing an array with three values attached and access them separately?
No, not yet. As GDL is based on programming language Basic, it doesn't have classes or structures. I has arrays, of course, which can serve as a grouping of values but they shouldn't be used to store heterogenous data.
Cleverbeans wrote:
4) Is their any means of creating custom functions or is that behavior entirely handled through macros?
Macros were created to extend the capabilities of GDL. So yes, they are the generic functions, but in a programming language analogy they could be classes in my opinion (since they have data and multiple scripts). Local functions can be implemented as named subroutines. These can be called only in the script defining them (with the exception of subroutines defined in the master script). Subroutines don't have formal parameters or return values but they can read and write all variables in the script 'globally'.

I hope you can solve many of your tasks with GDL in the future!
Zsolt Táskai
ArchiCAD Development - GDL Team
AC13, AC14 and upwards...
Anonymous
Not applicable
Thanks for the prompt reply!

I'll require an object to have either a wall, roof, or slab opening depending on a parameter. If I create an object and have it call the appropriate macro will it inherit the intelligent placement behavior or does the main object have to be an opening subtype?

If not, can this be done using the API?