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

GDL
About building parametric objects with GDL.
SOLVED!

Label object isn't update automatically

soo
Booster

Hi.. I'm GDL newbie.

 

I made a skin list label for drawing.

but there is a problem that it's not automatically updated.

 

After I edit a composite skins, the Skin list label isn't updated.

So I need to click another options for refreshing the object.

 

I really need to know How to automatically update the skin list label.

I'm happy to know any tips or advise. thank you.

 

 

ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ

this is how i called a composite skin's informations.

 

[MASTER]

type_Wall = 5
type_Slab = 7
type_Roof = 8

numFinish = 1

if GLOB_ELEM_TYPE = type_Wall then
numFinish = WALL_SKINS_NUMBER

for i = 1 to numFinish

parameters stFinish[i] = WALL_SKINS_BMAT_NAMES[i][1]
parameters thkFinish[i] = WALL_SKINS_PARAMS[i][2]

next i
endif

if GLOB_ELEM_TYPE = type_Slab then
numFinish = SLAB_SKINS_NUMBER

for i = 1 to numFinish

parameters stFinish[i] = SLAB_SKINS_BMAT_NAMES[i][1]
parameters thkFinish[i] = SLAB_SKINS_PARAMS[i][2]

next i
endif

if GLOB_ELEM_TYPE = type_Roof then
numFinish = ROOF_SKINS_NUMBER

for i = 1 to numFinish

parameters stFinish[i] = ROOF_SKINS_BMAT_NAMES[i][1]
parameters thkFinish[i] = ROOF_SKINS_PARAMS[i][2]

next i
endif

 

[2D]

stContent = "THK" + str("%.1mm", thkFinish[selectTmp])  + stFinish[selectTmp] 
1 ACCEPTED SOLUTION

Accepted Solutions
Solution

The issue is you are only populating a parameter with the value therefore the GDL object has to go through the step of running the parameter script. The master script, 2D script and 3D scripts are refreshed when you refresh the screen (pan or zoom) but the parameters are only updated when the tool is activated by opening the settings of moving a hotspot.

The solution is to populate the parameter as you are doing BUT ALSO populate what is called a "local variable" as a replica of the parameter. Then use this local variable in your 2D script rather than the parameter it is replicating.

 

So where you have:

for i = 1 to numFinish

parameters stFinish[i] = SLAB_SKINS_BMAT_NAMES[i][1]
parameters thkFinish[i] = SLAB_SKINS_PARAMS[i][2]

next i

 

you should have:

dim _stFinish[]                !!declaring the mimic local variable

dim _thkFinish[]             !!declaring the mimic local variable

for i = 1 to numFinish     !!populating the mimic local variable

        _stFinish[i] = SLAB_SKINS_BMAT_NAMES[i][1]
        _thkFinish[i] = SLAB_SKINS_PARAMS[i][2]

next i

!!now apply the local variable to the parameter

stFinish = _stFinish

thkFinish = _thkFinish

parameters stFinish = stFinish,

                    thkFinish = _thkFinish

 

In summary what you now have is both your parameter and a local variable storing the information. Use the local variable in your 2D script, instead of the parameter, for a dynamic response.

Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists

View solution in original post

3 REPLIES 3
Barry Kelly
Moderator

@soo ,

Sorry if you thought your posts kept deleting, it was because you had already posted in the Design forum (the wrong forum) so I moved that to the Documentation forum and deleted the other posts you made here in the Developers forum as they were the same (we don't want duplicates).

 

I see know you are asking about a GDL object you have created (that was not apparent before in your other posts).

So I have left this post here in the Developer's forum and removed the others.

 

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

thank you barry. I thought my post kept deleting because I shared the attached file. 

Solution

The issue is you are only populating a parameter with the value therefore the GDL object has to go through the step of running the parameter script. The master script, 2D script and 3D scripts are refreshed when you refresh the screen (pan or zoom) but the parameters are only updated when the tool is activated by opening the settings of moving a hotspot.

The solution is to populate the parameter as you are doing BUT ALSO populate what is called a "local variable" as a replica of the parameter. Then use this local variable in your 2D script rather than the parameter it is replicating.

 

So where you have:

for i = 1 to numFinish

parameters stFinish[i] = SLAB_SKINS_BMAT_NAMES[i][1]
parameters thkFinish[i] = SLAB_SKINS_PARAMS[i][2]

next i

 

you should have:

dim _stFinish[]                !!declaring the mimic local variable

dim _thkFinish[]             !!declaring the mimic local variable

for i = 1 to numFinish     !!populating the mimic local variable

        _stFinish[i] = SLAB_SKINS_BMAT_NAMES[i][1]
        _thkFinish[i] = SLAB_SKINS_PARAMS[i][2]

next i

!!now apply the local variable to the parameter

stFinish = _stFinish

thkFinish = _thkFinish

parameters stFinish = stFinish,

                    thkFinish = _thkFinish

 

In summary what you now have is both your parameter and a local variable storing the information. Use the local variable in your 2D script, instead of the parameter, for a dynamic response.

Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists