Resizing a parameter array
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-07-23
04:01 PM
- last edited on
2022-09-26
10:48 PM
by
Daniel Kassai
I've been trying to create a window object consisting of several 'subwindows', so that each subwindow has its own properties, which I store in a bunch of two-dimensional parameter arrays, one for each property. Each element in a parameter array represents one of the windows. To illustrate:
For example for the widths, I have defined an array called _widths, so that _widths[1][1] stores the width of the window in the lower left, _widths[2][1] the one to the right of that one and so on, up to _widths[4][3] that stores the width of the window in the top right corner.
The user is able to define the number of horizontal as well as vertical number of windows. The problem I've encountered is that my code is unable to expand the parameter arrays properly when the user sets a number larger than the previous one, e.g. 3 => 4 horizontal windows.
The code I've used is based on the answer given here. I've tried both creating a new array and setting the parameter array to that one using the 'parameters' command (which works for decreasing the dimensions of the parameter array), and simply defining the new elements in the parameter array (which was the recommended answer to that question), but none of these seem to work for me. Strangely enough, when editing the object in the gdl editor, the array elements are created, but the array seems to retain its dimensions:
However, upon modifying another parameter (which I assume runs the parameter script again?) the dimensions of the array are updated and correctly set to the new dimensions. This of course is not possible for me to do on a placed object, as the parameter script has already crashed further down due to trying to access an out of bounds index and the interface is subsequently only empty.
What would be the correct way to increase the dimensions of the parameter arrays? I know the simple solution for my specific problem would probably be to set a large enough dimensions to the parameter arrays and just not resize them, but that wouldn't really answer my question.
thanks

Solved! Go to Solution.
- Labels:
-
Library (GDL)
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-07-24 11:13 AM
The problem for me seemed to be that, although the resizing of the parameter array worked and was 'registered' as a change, it didn't come into effect until the following time an action was taken (in the gdl editor for example regenerating the 3D view or changing the value of some other parameter). The solution I found was to modify the parameter array like a normal array and extend it, and use it like a normal variable in the parameter script, and the following time the parameter script was run the parameter array itself would be updated and thus work correctly. In code it looked more or less like this:
! the parameter array => array[2][2] ! extend the array array[3][2] = some_value ! do all calculations etc. here ! set the parameter array using parameters command parameters array = array
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-07-23 05:25 PM
Central Innovation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-07-24 08:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-07-24 11:13 AM
The problem for me seemed to be that, although the resizing of the parameter array worked and was 'registered' as a change, it didn't come into effect until the following time an action was taken (in the gdl editor for example regenerating the 3D view or changing the value of some other parameter). The solution I found was to modify the parameter array like a normal array and extend it, and use it like a normal variable in the parameter script, and the following time the parameter script was run the parameter array itself would be updated and thus work correctly. In code it looked more or less like this:
! the parameter array => array[2][2] ! extend the array array[3][2] = some_value ! do all calculations etc. here ! set the parameter array using parameters command parameters array = array
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-07-24 12:11 PM
Specifically the Dynamic Array solution from the legendary Frank Beister.
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-07-24 04:16 PM
Ralph wrote:
I developed an object that does this for GS UK – Modular Joinery Object - and it's available to customers up to the latest version.
Is it still there Ralph?
When searching via the Door or Window tool, the object shows up. However, when clicking OK to download, it, I get the error below. For the record, my SSA is valid.
Clicking on the BIMcomponents link in the tool dialogue box leads to a 404.
I hope this is a temporary glitch. I'll have to hunt through embedded objects in some old project to retrieve it, otherwise. This one's too precious to lose.
bT Square Peg
https://archicadstuff.blogspot.com
https://www.btsquarepeg.com
| AC INT | Win11 | Ryzen 5700 | 32 GB | RTX 3050 |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-07-24 07:10 PM
blob wrote:It can be even simpler than that - just assign a value at the array bounds you want and then make the same statement leading with parameters, e.g.:
OK, so I've found a solution to my own problem, and I think it might be the solution for how to resize a parameter array, or at least an option.
The problem for me seemed to be that, although the resizing of the parameter array worked and was 'registered' as a change, it didn't come into effect until the following time an action was taken (in the gdl editor for example regenerating the 3D view or changing the value of some other parameter). The solution I found was to modify the parameter array like a normal array and extend it, and use it like a normal variable in the parameter script, and the following time the parameter script was run the parameter array itself would be updated and thus work correctly. In code it looked more or less like this:
! the parameter array => array[2][2] ! extend the array array[3][2] = some_value ! do all calculations etc. here ! set the parameter array using parameters command parameters array = array
something[5][5] = 1.0 parameters something[5][5] = 1.0
Central Innovation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-07-24 07:11 PM
vistasp wrote:Should be - I check it every year for GS UK. It's running fine in AC24, so I expect there's some distribution problem if it's not showing up. Check with your support
Ralph wrote:
I developed an object that does this for GS UK – Modular Joinery Object - and it's available to customers up to the latest version.
Is it still there Ralph?
When searching via the Door or Window tool, the object shows up. However, when clicking OK to download, it, I get the error below. For the record, my SSA is valid.
Clipboarder.2020.07.24-002.png
Clicking on the BIMcomponents link in the tool dialogue box leads to a 404.
I hope this is a temporary glitch. I'll have to hunt through embedded objects in some old project to retrieve it, otherwise. This one's too precious to lose.
Central Innovation

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-07-25 04:11 PM
Seems to be a v24 bug. The button shows properly in v23.
bT Square Peg
https://archicadstuff.blogspot.com
https://www.btsquarepeg.com
| AC INT | Win11 | Ryzen 5700 | 32 GB | RTX 3050 |

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-07-29 08:40 AM
I added the hidden button to our bug database.
Software Engineer, Library
Graphisoft SE, Budapest