GDL
About building parametric objects with GDL.

RETURNED_PARAMETERS

dushyant
Enthusiast
Hi

I'm trying to return some parameters from an object called in the parent object. I have placed the parameter names after the 'END' in the parameter script. In the caller, I'm doing as:
CALL 'childObject' PARAMETERS RETURNED_PARAMETERS param1
Then if I try, say
PRINT param1
it gives an error: "Unitialised variable"

I tried calling the object in the 3D script, Master script, and the Parameter script, and get the same error.

How do I access the returned parameter? I have tried in a similar way for another set of objects calling another macro, and it worked there. Don't understand what's wrong here..

Thanks
23 REPLIES 23
Podolsky
Ace
As you described, in another scripts this method is working. Try to search error in your macro. The error can be the reason why macro is not passing parameter. This the most annoying part in programming. Sometimes it can be some silly misspelling, that ruined the whole script.
dushyant
Enthusiast
I checked all scripts, and there's no error prompted...
Podolsky
Ace
Publish your objects here - maybe someone will figure out where is the problem.
Barry Kelly
Moderator
dushyant wrote:
Then if I try, say
PRINT param1
it gives an error: "Unitialised variable"

Uninitialised variable just means it does not know what type of variable it is, number, string, etc.

Try adding ...

param1 = 0

or

param1 = "" (if it is a string)

Before the CALL command.

That way you are initialising the parameter before you use it.
I think also if you set the parameter in the parameter list of your parent object, that will do the same thing.


Barry.
One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
dushyant
Enthusiast
Barry,

Initialising the variable before the macro call does avoid that error of 'unitialised variable'. But then the value is still not changed.. meaning the macro is not returning it perhaps.

Yes, I had set the parameter in the parent object same as the RETURNED_PARAMETERS. Since it didn't work, I removed them to check if that was clashing with it.

Anyway, I'll check the macro object again.
dushyant
Enthusiast
By the way, where do you normally place the CALL in the parent object?

The object I'm calling is actually a chair so I am calling it in the 3D script. And since I need the dimensions, I am returning the parameters in the macro from the Parameter script.

Does the placement of these in a particular script in both the parent & macro affect in anyway?
dushyant
Enthusiast
I just tried with another test object as macro, and returned a value from it in the Parameter script. Then I called it in the Parameter script of the caller and its returned-params are successfully received.
But when I called the same macro in the 3D script, the returned params are not received it seems..

So again, I would like to know if it matters from which script we return the params in the macro and in which script we call it in the caller.
Barry Kelly
Moderator
If you are looking at setting parameter values, then I would CALL in the master or parameter script.
Ideally master - then all scripts will have access to this returned parameter value.
If you CALL in the 3D script, that parameter value can only be used in the 3D script.
At least that is my understanding of how it works.

Barry.
One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
dushyant
Enthusiast
Ok Barry.

So far I observed it just does not retrieve the returned parameters in the 3D script. Anyone, please let me know if it is possible to get the returned parameters from a macro called in the 3D script.