BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

GDL
About building parametric objects with GDL.

Problem: Persistent Parameter Arrays Values & deletion

Nader Belal
Mentor
Hi everyone,

I have a problem with parameter arrays and deletion process that can be resumed as, inability to delete their values with every known process ...

Background:
I have a bunch of 2D parameter arrays of different types mainly integers that goes in parallel (ie: all have same length and width) to act as information placeholders; and the majority of these integer arrays were used with values{2} function, and connected to the GUI using UI_INFIELD function (or any of its version).
Mentioned arrays will have a size 20*50 (but I was working with a smaller version of them).

Problem:
What ever process I try to delete those arrays, I find that they still have the same width, or some get deleted others as if nothing happened.

Tested methods:
  •  
  • Substitution of "APPLICATION_QUERY" function method "firstoccasion_in_progress" with time stamp as explained in DELETE AN ITEM FROM A PARAMETER ARRAY
  •  
  • Using Parameter Buffer Manipulation using Braza's method in LIMITING RANGE OF PARAMETER ARRAYS either by not copying undesired values from Parameter Arrays or Temporary Variable Arrays, of vise versa
  •  
  • Deleting all values from Parameter Arrays (including re-initialising them with 1-2 values) then copying the values from Temporary Variable Arrays to Parameter Arrays.
    In this time, many arrays didn't accept any values.
  •  
  • Changing parameter arrays names.
  •  
  • Arrays' script manipulations were defined in "Parameter Script" & "Master Script"


Request:
A sure fire method for parameter array value update.
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.
2 REPLIES 2
Bruce
Expert
Have you tried re-declaring the arrays?

The process for flexible-length arrays:

1. Declare a temporary array
2. Fill the temporary array with the parameter array
3. Re-declare the parameter array
4. VALUES commands to be listed after this declaration, not before


Sample code, where 'size1' is an integer parameter, and myArray is a length parameter, activated as an array.
IF GLOB_MODPAR_NAME = "size1" THEN
	DIM _tempArray []
	_tempArray = myArray
	
	DIM myArray []
	FOR ii = 1 to size1
		IF ii > vardim1(_tempArray) THEN
			_value = 0
		ELSE
			_value = _tempArray[ii]
		ENDIF
		myArray[ii] = _value
	NEXT ii
	PARAMETERS myArray = myArray
ENDIF

VALUES "myArray" RANGE (0, )
Bruce Walker
www.brucepwalker.com
Barking Dog BIM YouTube
Mindmeister Mindmap
-- since v8.1 --
AC27 5003 INT Full | Windows 11 64 Pro | 12th Gen Intel i7-12700H 2.30 GHz | 64 Gb RAM | NVIDIA GeForce RTX 3060 32 Gb
Peter Baksa
Graphisoft
Graphisoft
Hi Moonlight,

This code works for me:
if GLOB_MODPAR_NAME = "reset" then
	dim ar1[1][1]
	dim ar2[1][1]
	parameters ar1 = ar1, ar2 = ar2
endif
Maybe if there is another connection between your arrays based on some GLOB_MODPAR_NAME, it might not work as expected.
Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest
Learn and get certified!

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!