Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

How to delete/reset an array?

Sam Karli
Enthusiast
Hi,
i have an array used more than once through a subroutine (sort it). The data stored in array varies, so does the length of the array. The problem is that I access/use array length through vardim1(array).

If in a previous use of the subroutine the array was longer, the array stays the same (longest) length, and the sorting algorithm will sort junk into the array.

So I would need resetting/deleting the existing array (of that name).

Is there a sollution for this? (Without splitting the stuff into different macros that will slower running it.)
GDL/Python/C++ dev
1 ACCEPTED SOLUTION
5 REPLIES 5
Solution
Sam Karli
Enthusiast
Just realized that dim can be used multiple times and thus for resetting arrays.
GDL/Python/C++ dev
Nader Belal
Mentor
Just a question,

Have you been successful to achieve the same thing for array parameter ?
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.
Barry Kelly
Moderator
Moonlight wrote:
Just a question,

Have you been successful to achieve the same thing for array parameter ?
I don't think you can delete just one array parameter easily.

My understanding and as explained in the other post I think ...


https://archicad-talk.graphisoft.com/viewtopic.php?p=293488#p293488


You have to read all of the array values into an new array.
Then reset the original array and then add back all of the values except the one you want.
Effectively you will have deleted the value that you want.
That is about my limit of knowledge with arrays.
I have never actually tried doing this myself.

Barry.
One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Nader Belal
Mentor
Hi Barry,

I already have done that and it doesn't work, and I don't know why, so I´m open to suggestions
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.
Nader Belal
Mentor
To Barry,

I have found what is wrong, and I will write it in detail in this link.

https://archicad-talk.graphisoft.com/viewtopic.php?f=6&t=66012
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.

Start a new conversation!

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!