Tagged: parameters macro call
January 15, 2019 at 09:17 #4455
i’m having trouble wrapping my head arround some issues regarding interfaces called by macros and teir data. The situation:
I modified the UI code that sits in Macro3 and it is displayed fine in the UI of the main object. Now i would like to use the user set value from the main object UI in the 3D-Script of Macro3. Do i have to pass it as parameter all the way down the macro chain to make it work? Is the macro treated as a function of the main object? In that case it should be able to read the value in the main object which it doesn’t. This left me quite confused maybe someone could explain it in detail or point me out to a ressource helping me?
Thanks in advance!
January 15, 2019 at 09:47 #4456
This works like in other languages’ function calls, just without the parentheses.
To pass a parameter to a macro, use
parameters all, or set it explicitly:
call "macro" parameters p = p, .... The called macro’s unset parameters will be initialized to their default values visible in the parameter list.
A macro doesn’t know about its caller’s parameters, so if it doesn’t have one, it can’t be passed further, and the lower macro’s parameter will be again initialized to its default value in the lower macro.
So all the intermediate macros have to have the parameters that you are passing to the furthest one, and they have to be set in each macro call.
Software Engineer, Library Team
January 15, 2019 at 16:14 #4460
Thanks for the help Peter! Your detailed explanation helped a lot.
You must be logged in to reply to this topic.