License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
GDL
About building parametric objects with GDL.

Initiate array gdl

Mathias Jonathan
Advocate

Hello to all.

 

I'm just starting to work with arrays, and I have some problems .

 

I'm still working on an object to change the text of objects from the model view options, and for that I need a matrix in which I indicate 1/ the name I want to change 2/ the name that should appear.

 

For example, 'living room" on the left and "Liv. " On the right.

 

Capture d'écran 2023-05-21 134733.png

 

 

I would like to know how to initialize an array to be able to use it.

 

For example, to use the array I had initialized with DIM arrayValeurs_glob[] , I had to manually enter empty values from my parameters tab to be able to display values in my interface.

Capture d'écran 2023-05-21 134532.png

 

If these values had not been created manually, they did not appear.

 

I wish I could avoid that, especially since this method made my script bug:

 

I went from 3 values to 12 values per matrix, and my script (template view option) didn't update because it remembers I had 3 values and doesn't want to update.

Capture d'écran 2023-05-21 134805.png

 

 

Do you have any ideas/examples?

 

 

 

Thank you!

2 REPLIES 2
MetalFingerz
Advocate

Once you declared your array, you could initialize it with a FOR loop using VARDIM1() and give your array default values (assuming your array is not null). VARDIM1 will give you the size of a one dimensional array.

for piece = 1 to vardim1(arrayValeurs_glob)
    arrayValeurs_glob[piece] = "defaut"
next piece

 

Then you would need to update the values of your array with PARAMETERS

parameters arrayValeurs_glob = arrayValeurs_glob

 

Lingwisyer
Guru

If you look at the master script of this object, you will see that the array size is updated each time a relevant variable is updated. If the array size value is not accessible, you can delete it, save, let the object fail to generate, then recreate the parameter. There is probably some better way to force it to update, but that is what I did a few times when I changed my array widths...

 

 

Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!