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

GDL
About building parametric objects with GDL.

Call macro and parameters all

Anonymous
Not applicable
Hi,
I try to understand macros. Some elements from Graphisoft include this part of the script.
call "macro",
parameters all alpha = alpha
Why do I need "alpha = alpha", when the name of the variable is the same in the caller object and in the macro?

Thanks for your support.
4 REPLIES 4
Dominic Wyss
Booster
Hi Manuel

Maybe the value of alpha was modified in the caller script. So its actual value has to be passed with
alpha = alpha
In this situation the first "alpha" is a variable and the second "alpha" is the name of the parameter in the called macro.


if you don't do that the original value will be passed to the macro:

!parameter list:
!alpha = 90

!masterscript:
alpha = 270

!2d-script:
call "macroname" parameters all ! <= alpha in macro = 90
call "macroname" parameters all alpha = alpha ! <= alpha in macro = 270
HTH Dominic
AC27 CHE - macOS Ventura M1
Anonymous
Not applicable
Hi Dominic,

Can I use CALL from macro parameter become to other parameter in call object?
Example: I want to call Resize_A_B macro (A, B parameter for resize) but in my object I want to resize difference parameters (e.g. width & height parameter)

Thanks in advance
Peter Baksa
Graphisoft
Graphisoft
No, a macro can only change parameters (parameter script, hotspots) that the placeable object has, GDL doesn't have the concept of passing parameters by reference.
Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest
Peter Baksa
Graphisoft
Graphisoft

!parameter list:
!alpha = 90

!masterscript:
alpha = 270

!2d-script:
call "macroname" parameters all ! <= alpha in macro = 90
call "macroname" parameters all alpha = alpha ! <= alpha in macro = 270
That's not the case, both calls will give alpha = 270 to the macro.
Writing any <param> = <param> after all is just an emphasis.
It has to be written only in case when the placeable object doesn't have a parameter that the macro has (when it's only a variable in the caller object).
Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest