Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Resizing a parameter array

Anonymous
Not applicable
Hello!

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
1 ACCEPTED SOLUTION

Solution
Anonymous
Not applicable
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

View solution in original post

10 REPLIES 10

Ralph Wessel
Mentor
I developed an object that does this for GS UK – Modular Joinery Object - and it's available to customers up to the latest version. Might be easier to see if you can get that rather than starting from scratch.
Ralph Wessel BArch

Anonymous
Not applicable
Hi Ralph, I appreciate the reply! I had previously looked at the post you linked, and it seems really functional. It does not solve my problem, however, as the object I'm developing was ordered by a client and needs to have specific properties. I'm also curious about the answer to my question, i.e. how to resize a parameter array.

Solution
Anonymous
Not applicable
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

View solution in original post

Anonymous
Not applicable
Have you checked this topic: https://archicad-talk.graphisoft.com/viewtopic.php?f=6&t=30992&hilit=elastic&sid=c5532286a247966143b...
Specifically the Dynamic Array solution from the legendary Frank Beister.
Hope this helps.

vistasp
Expert
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.
= v i s t a s p =
bT Square Peg
https://archicadstuff.blogspot.com
https://www.btsquarepeg.com
| AC 9-25 INT | Win10 | Ryzen 2600 | 16 GB | GTX 1150Ti |

Ralph Wessel
Mentor
blob wrote:
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
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.:
something[5][5] = 1.0
parameters something[5][5] = 1.0
Ralph Wessel BArch

Ralph Wessel
Mentor
vistasp wrote:
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.
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 Wessel BArch

vistasp
Expert
Turns out the glitch is not in BIMcomponents, but in the dialog box itself. The button for Download and Embed is getting (almost completely) hidden because of the extra text telling me that the object is Premium Content. It is clickable, but not very noticeable. Yesterday, I'd been directly clicking on OK, since I didn't see that little part of the button.

Seems to be a v24 bug. The button shows properly in v23.

= v i s t a s p =
bT Square Peg
https://archicadstuff.blogspot.com
https://www.btsquarepeg.com
| AC 9-25 INT | Win10 | Ryzen 2600 | 16 GB | GTX 1150Ti |

Peter Baksa
Graphisoft
Graphisoft
Hi vistasp,
I added the hidden button to our bug database.
Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

vistasp
Expert
Peter wrote:
Hi vistasp,
I added the hidden button to our bug database.

Thanks, Peter.
Cheers.
= v i s t a s p =
bT Square Peg
https://archicadstuff.blogspot.com
https://www.btsquarepeg.com
| AC 9-25 INT | Win10 | Ryzen 2600 | 16 GB | GTX 1150Ti |

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!