2020-11-2503:05 AM - last edited on 2021-09-1509:29 AM by Noemi Balogh
Here is the setup. I am trying to make a simple (2D text only) gsm which lists the consultants active on a specific project. I have created a subtype which has the relevant fields and have made several macros representing the different consultants. I can successfully call these macros into my main gsm using a CALL and obtain the relevant values using the RETURNED_PARAMETERS command.
But... I cannot figure out how to make a 'deep copy' of the returned values which are all text string parameters. I cannot use the PUT command because these are strings. And if I store them in an array or as independent values they all revert to the current state of the consultant parameters.
I could of course make a gigantic gsm with one parameter for every possible consultant and all relevant subfields. But this seems crazy when it would be so much easier to simply call some flexible number of consultants per project.
Please advise whether this overall conceptual approach seems reasonable. If yes, is there something I am missing? If no, are there any resources covering this type of situation?
I am a little confused as to exactly what you are trying to do.
When you CALL an object, it will not be getting information from a placed object.
It is simply CALLing the default object in the library with all of its default settings.
So if you are placing individual objects for each consultant, there is no way for another object to to get values from the place consultant objects.
Unless you want to delve into reading and writing to external text files, but that is a bit messy and does not always update instantly (you have to force a model re-build).
Maybe what you want to do is place all of your consultant objects with all of their correct settings, and then schedule those objects, listing the parameters that you want to see?
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
I can successfully call these macros into my main gsm using a CALL and obtain the relevant values using the RETURNED_PARAMETERS command.
But... I cannot figure out how to make a 'deep copy' of the returned values which are all text string parameters.
What do you mean by deep copy? GDL doesn't use references and pointers, everything is returned by value.
Arrays can be copied with a single statement if their number of dimensions match. There is a trick here: macros can only return one-dimensional arrays. When a two-dimensional array is used in an end statement, it is converted ("flattened") two a one-dimensional array. If the caller object has to use it as two-dimensional, a for loop is needed to reconstruct the original array.
Péter Baksa Software Engineer, Library as a Platform Graphisoft SE, Budapest