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.
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

dynamic arrays not dynamic

When AC7 came out, we were told that DIM statements could now work with a variable instead of a fixed number, e.g.

num=60
DIM xx[num]

If you try this, even in ArchiCAD 8.1, it still doesnt work, you still get an error message saying that you must put a valid number into the brackets e.g.

DIM xx[60]

I havent really chased this one with Gs as i havent needed it, but I wanted it today and couldnt use it.

Perhaps the object works, but the error checking routine still reports an error. That is still the case with built in Material definitions.
5 REPLIES 5
Anonymous
Not applicable
David,

I have made variable arrays successfully with the format:

DIM matthews_variable_array [ ][ ]

I forget now, but I think a space character is required inside each pair of brackets (I don't feel like launching AC right now to check).

HTH,
Matthew
Matthew wrote:
David,
I have made variable arrays successfully with the format:

DIM matthews_variable_array [ ][ ]

I forget now, but I think a space character is required inside each pair of brackets (I don't feel like launching AC right now to check).
I know how you feel......
But are you saying that putting NOTHING but a space in the brackets works??? that would create an array without limits!!
rocorona
Booster
But are you saying that putting NOTHING but a space in the brackets works??? that would create an array without limits!!
This is exactly what the GDL User Manual says...
If you use empty square brachets, the GDL interpreter evaluates the needed size during the compilation.

Chapter 11
Expressions and Functions
...
Dynamic arrays
...
Variable expressions cannot be used as dimensions. If they are missing, the array is declared to be dynamic (one or both dimensions).
...
Parameter arrays do not have to be declared in the script and they are
dynamic by default.
...
For dynamic arrays there is no limitation for the actual index value. During the interpretation, when a non-existing dynamic array element is given a value, the necessary quantity of memory is allocated and the missing elements are all set to 0 (numerical). Warning! This may cause an
unexpected out of memory error in some cases.
_________________

--Roberto Corona--
www.archiradar.com
AC18 - ITA full on Win10
_________________
_________________
Anonymous
Not applicable
david wrote:
But are you saying that putting NOTHING but a space in the brackets works??? that would create an array without limits!!
Shucks, David, I thought that's what you wanted. You do have to be careful not to fill it too much though. A billion values could fill up the available RAM
LiHigh
Newcomer
david wrote:
But are you saying that putting NOTHING but a space in the brackets works??? that would create an array without limits!!
In a way, yes. But the size of the array would be the last row of array that have been assigned a value. For example:

DIM xx[][]

FOR i=1 to num1
FOR j=1 to num2
xx=fl_max-flight_length+dyy
NEXT j
NEXT i

The size of this particular array is num1xnum2 and it can be retrieved using GDL syntax:

VARDIM1(XX)=num1
VARDIM2(XX)=num2
Howard Phua

Win 10, Archicad 19 INT