GDL
About building parametric objects with GDL.

Using Dictionary in Parameters?

DGSketcher
Legend
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.
Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)
7 REPLIES 7
A_ Smith
Expert
AFAIK "array option" was and is available to every type of parameter (length, angle, real number and so on)
AC 22, 24 | Win 10
DGSketcher
Legend
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?
Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)
runxel
Legend
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.
Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
Peter Baksa
Graphisoft
Graphisoft
DGSketcher wrote:

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.
Péter Baksa
Software Engineer, Library
Graphisoft SE, Budapest
DGSketcher
Legend
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.
Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)
DGSketcher
Legend
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, MyDict.X, MyDict.Y 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?
Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)
DGSketcher
Legend
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.
Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)