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

GDL
About building parametric objects with GDL.

GDL: Refresh Array Width on Code Modification

Lingwisyer
Guru

Hi all,

 

When you change the width of an array parameter, this change is not passed onto existing objects resulting in them failing to generate as they return an "invalid array width" error. Is there a way to get around this without having to delete all of the relevant parameters, reload all the objects, then recreate the parameters with their new 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
3 REPLIES 3
runxel
Legend

You can always select all respective objects and then "Reset to Default Settings". This fixes it.

Obviously now everything else is reset, too.

Other thing would be to write a migration script which would preserve all other settings, but writing those is tedious.

So, its "pick your poison".

Lucas Becker | AC 27 on Mac | 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»
Jochen Suehlo
Moderator

I use 2 different approaches:
a) If the array-size is not dynamically, I write e.g.:

IF VARDIM1(array) < yx THEN

FOR i = VARDIM1(array) TO no_array
PARAMETERS array[i] = "..."
NEXT i
b) If the array size  is dynamically I add an update checkbox

and let the Parameter-Script run once with GLOB_MODPAR_NAME.
After this the update checkbox disappears.

Jochen Suehlo . AC12-27 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de
DGSketcher
Legend

I wish there was greater clarity on Array definitions and how they react in certain situations.

 

The Forward Migration script suggested by @runxel maybe the best option, that way you can keep your existing object in working order. My understanding of the Migration Script is the default is to populate the new parameters with the old parameters as long as they are still present. You don't need to list and action them all. The only one you would need to process would be the array, unless you have other array related values. You could try creating a new Parameter Array and migrate the values with For - Next loops. The following read values from a redundant one dimension array and added the values to a new two dimension array.

 

 

    DIM arrTemp1[]
    xx = DELETED_PAR_VALUE ("arrDimx1",	arrTemp1)
    FOR n = 1 TO VARDIM1(arrTemp1)
	arrDimx2[n][8] = arrTemp1[n]
    NEXT n

    PARAMETERS arrDimx2 = arrDimx2

 

 

 

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)

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!