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

GDL
About building parametric objects with GDL.
SOLVED!

Request changes Array format

DGSketcher
Legend

I have a 2D Parameter array in object A which is formatted as Array [m][n] but in object B when I use REQUEST I end up with Array [1][m x n] in the imported array and dim1 & dim2 values. Any suggestions why this is happening before I transfer the values into a new 2D array?

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

Accepted Solutions
Solution
DGSketcher
Legend

@SenecaDesignLLC Thanks for the response, I guess I should spend a bit more time with the manual...

p_values: for ASSOCLP_PARVALUE returns the parameter value or array of values. The array elements are returned successively, row by row as a one dimensional array, independently of the dimensions of the variable specified to store it. If the variable is not a dynamic array, there are as many elements stored as there is room for (for a simple variable only one, the first element). If values is a two dimensional dynamic array, all elements are stored in the first row.

 

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

View solution in original post

4 REPLIES 4

This is a complicated question (kind of) but seems relevant to the code, can you post something or an image with more info? Debugging is difficult with such minimal information.

DGSketcher
Legend

Things are pretty much as I suggested above, but I will try to expand.

In Object A (subtype: Wall) I have a parameter array MyArray[m][n] which is correctly reporting changes & values of real numbers.

In Object B (subtype: Label) I want to import that array so I use...

MASTER SCRIPT:
n = REQUEST ("ASSOCLP_PARVALUE", "MyArray" , name_or_index, type, flags, dims1, dims2, MyArray)
MyArray = MyArray
PARAMETERS MyArray = MyArray

!dims1 & dims2 correctly supply values m & n
!but
!VARDIMS1(MyArray) = 1 & VARDIMS2(MyArray) = m * n

The MyArray[m][n] parameter values in Object B aren't updating, but that may be a different issue.

In Object B if I want to use the values in MyArray I have to use Value = MyArray[1][m x n]. 

 

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

@SenecaDesignLLC Thanks for the response, I guess I should spend a bit more time with the manual...

p_values: for ASSOCLP_PARVALUE returns the parameter value or array of values. The array elements are returned successively, row by row as a one dimensional array, independently of the dimensions of the variable specified to store it. If the variable is not a dynamic array, there are as many elements stored as there is room for (for a simple variable only one, the first element). If values is a two dimensional dynamic array, all elements are stored in the first row.

 

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

Yeah, you found the critical text.

 

Btw same holds true for macro returns, and returns from any GDL Addons. The returned array will be always one-dimensional.

Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | 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»