2020-11-2406:05 PM - last edited on 2021-09-1512: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 25 Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10 Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10
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