The Global Archicad Community

Stay informed. Get help. Share your knowledge.

Topics specific to the scripting and development of Library Parts and Libraries using Param-O or the Geometric Description Language – GDL. (Example: How do you use “REQUEST” GDL commands?)

Moderators: Karl Ottenstein, LaszloNagy, ejrolon, Barry Kelly, Gordana Radonic, nbalogh, mnguyen, gkmethy, rmasaki, Akos Somorjai, Csilla Mai, Peter Baksa

By DGSketcher
#320367
In AC24 I have noticed in the Array option has been removed and replaced with Dictionary.
Can we display the contents?
How do we to edit these values?

I can't access this type of variable in my objects.
Attachments
Screenshot 2020-12-17 at 23.59.20.png
Screenshot 2020-12-17 at 23.59.20.png (56.67 KiB) Viewed 245 times
By A. Smith
#320389
AFAIK "array option" was and is available to every type of parameter (length, angle, real number and so on)
Attachments
array.png
array.png (1.54 KiB) Viewed 222 times
By DGSketcher
#320391
Thanks, that gets the Array option back, memory failure on my part.

So, Dictionary values... these seem to be useless in the Parameter list. You can't assign a subkey value like _mydict.x as the "." is invalid in a parameter name and there is nowhere to actually enter a value. Can someone explain why Dictionary is listed as a Parameter type? Is this just incomplete programming?
User avatar
By runxel
#320395
This was probably introduced to be able to pass whole dictionaries to macros.
(Which is a really great thing, ngl)
I can't see any other reason, tho.
User avatar
By Peter Baksa
#320741
DGSketcher wrote: Fri Dec 18, 2020 12:15 pm
So, Dictionary values... these seem to be useless in the Parameter list. You can't assign a subkey value like _mydict.x as the "." is invalid in a parameter name and there is nowhere to actually enter a value. Can someone explain why Dictionary is listed as a Parameter type?
Hi DGSketcher,

There are a few limitations with dictionary parameters:
- defaults can't be set in the parameter list in the GDL editor. Parameter values can be set from the parameter script, which become default if you check the parameter script and save the object. Defaults can also be set in the parameter list of HSF source code.
- they can't be used on the UI as input
- they can't be used for editable hotspots
- they can't be shown in IES
- VALUES and LIBRARYGLOBAL commands don't work with dictionaries

The main use is for macros, where they aren't set by the user but some calculation.
By DGSketcher
#320747
Thank you Peter, that is helpful. GDL programming is only a hobby for me so sometimes the constraints & uses you have described aren't always obvious to less experienced programmers. I have confronted the UI recently and this has also caused some confusion regarding the assignment of values to parameters. As I see it you can assign single and array values in the Parameter list, Parameters can't be set from the 2D & 3D script but their values can be changed within the script, The Parameter Script is where Parameter values are normally constrained and adjusted in reaction to other Parameter changes, and the UI Script allows the UI_INFIELD{#} command to set parameters & also double as value lists. Perhaps a Tips & Tricks page on the GDL site could help new users determine where best to assign values to a parameter.
By DGSketcher
#320863
Still chipping away at this...

So I now have my working GDL object with a Dictionary full of useful arrayed values e.g. MyDict.Name[n], MyDict.X[n], MyDict.Y[n] etc. I now need to get these values out to labels & macros. The labels I assume I can get to read them via REQUEST but I still can't find any documentation on how to expose the dictionary to a label or push the values to a macro. Anyone got any pointers on how and the associated syntax please?
By DGSketcher
#320891
Answering my own Q here... Having read the user manual in a bit more detail, under the section describing the DICT function there is an explanation of "Macro calls and requests:
• in macro calls, dictionary type values can be sent to the macro if there is a dictionary type parameter on the receiving end,..." and with regards to REQUEST options, currently there is no request supporting dictionaries.