We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

GDL
About building parametric objects with GDL.

how to link parameters to local variables in a label object

soo
Booster

While making the label for slab complex, I found that the number of skins added to the complex was not automatically reflected.

제목 없음-1.png

after modifying the complex, Parameters reflecting the number of skins in the label are not reflected.

제목 없음-2.png

I tried to update this numText parameter to the current state by itself, but my ability was not enough.

It is updated only when I enter the settings and do some changes.

 

<PARAMETER>

soo_0-1671084110633.png

 

<MASTER>

if GLOB_ELEM_TYPE = WALL_TYPE then
THICKNESS = WALL_THICKNESS
SKINS_NUMBER = WALL_SKINS_NUMBER
endif

if GLOB_ELEM_TYPE = SLAB_TYPE then
THICKNESS = SLAB_THICKNESS
SKINS_NUMBER = SLAB_SKINS_NUMBER
endif

if GLOB_ELEM_TYPE = ROOF_TYPE then
THICKNESS = ROOF_THICKNESS
SKINS_NUMBER = ROOF_SKINS_NUMBER
endif

 

<PARAMETER>

if LabelType = LabelTypes[1] then
parameters numHotspot = SKINS_NUMBER + numTextAdd
parameters numText = SKINS_NUMBER + numTextAdd
endif

 

 

I'm happy to know how to solve this issue. Thank you.

2 REPLIES 2
Barry Kelly
Moderator

Try this.

You may just need to set the value of the parameter to be used in your scripts as well as setting the parameter value you see in the PARAMETERS list.

You should never just use 'parameters numHotspot = SKINS_NUMBER + numTextAdd' as that changes the value in the list but not that actual value of the parameter used in the script.

 

if LabelType = LabelTypes[1] then
    numHotspot = SKINS_NUMBER + numTextAdd
    parameters numHotspot = numHotspot

    numText = SKINS_NUMBER + numTextAdd
    parameters numText = numText
endif

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

Hi,

 

To understand it better, think about variables and parameters as a different thing.

In the script you don't access the parameters, only their copies as variables. They get initialized with the parameters' values, but aren't kept in sync afterwards. After a variable is changed, the parameter value can't be accessed afterwards. Changing a variable doesn't change the parameter, changing a parameter with a PARAMETERS command doesn't change the variable.

 

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest