BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Subroutines - passing arguments ???

Anonymous
Not applicable
Hi,
I'm really missing the possibility to pass arguments to subroutines in GDL.
Is it really so there are no possibility to do that, or is it just I that has avoided to find information about it?
I also got to know there are an interface to Phyton, so I can call Phyton-modules from GDL. Do someone has experience by this? Is this functioning well, and is it easy to learn Phyton when I've experience with other languages like Java, Pascal, Fortran, scripting ...etc ?
In other words are there something that is very different in Phyton than in other languages?
5 REPLIES 5
Anonymous
Not applicable
Assuming you mean to pass parameters, this is done in the form:
CALL "macro name" PARAMETERS A = 1, B = 2, something = "nothing"   !etc...
For more details look up the CALL statement in the GDL Ref Manual (page 222 in my copy).

To interact with Python or other programming languages you might be able to use the limited text and data I/O extensions, but it's likely that you would need to get into API stuff. There are others here that know much more than I do about this.
Ralph Wessel
Mentor
Anne wrote:
I'm really missing the possibility to pass arguments to subroutines in GDL.
Is it really so there are no possibility to do that, or is it just I that has avoided to find information about it?
No, there isn't any way to define functions in a GDL script, at least not in the same sense as other languages (or indeed the functions in GDL itself). The method of calling macros suggested by Matthew is similar, but messy - I avoid using macros wherever possible.
Ralph Wessel BArch
Anonymous
Not applicable
Thank you for your answers. I was thinking of the GOSUB "subroutine",
but maybe I should try to figure out more about using Phyton to "hold" functions I could call. Do someone here know wheter users downloading the GDL-objects (calling Phyton functions) need to have any extra resources on their computers to use this GDL-object? Or if something extra regarding Phyton has to be included in the library being downloaded.
Anonymous
Not applicable
You can use Macro objects to act as functions as a work around as well. To demonstrate lets say you want a function that takes x and y values and returns x + y. To make this happen, create a library part of macro type with two parameters x and y. Then in your "function" object's main script have the following code...
EXIT x + y
Now, to call the function use the following code in another object
CALL "function" PARAMETERS x = x_value, y = y_value, RETURNED_PARAMETERS sum
Now the new object will have a variable, sum, which is assigned the value x_value+y_value since those were the values into x and y.


Also, where have you heard of a Python interface GDL? I haven't found anything of the sort but I would love to have access to them if possible.
Anonymous
Not applicable
Thanks. I think macros are the solution.
I have understood since last, that GDL is two different technologies,
and it's the other that has an interface to Phyton.
Learn and get certified!

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!