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

Delete an item from a Parameter Array

Nader Belal
Mentor
Hello everyone,

If I have a Parameter array that is filled with different values, but I need to delete one specific item in the middle, how should this problem be handled using GDL ??

PS: I´m not talking about a variable array.
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.
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Nader Belal
Mentor
To everyone,

First I want to thank you all for all the help, especially to my friends Carlos Lopez Figueroa from Mexico for putting me on the right track, and Shawn Hopkins.

Second, the right way (in my case) to do update/delete array parameters is using this simple code that was posted in this thread https://archicad-talk.graphisoft.com/viewtopic.php?t=30992&start=30 (special thanks to Braza from Portugal, see attachment )

here is the script (adapted to Graphisoft Style recommendations😞
dim setval[]
for i = 1 to n

	if i > vardim1(val) then
		setval = 0
	else
		setval=val
	endif
next i

val = setval

parameters val = val

Third the most important part, Why the hell my past code did not update my arrays !!!


Well it happens that this line script in the Parameter Script tab did give me all the trouble:

n = APPLICATION_QUERY ("PARAMETER_SCRIPT", "FIRSTOCCASION_IN_PROGRESS", _isFirstRun)
It appears to be that this past line was preventing the arrays from being updated, and to by pass any issue that may result from consecutive value deletion you have to put a time stamp, as have been explained in other threads in this forum.

I will put this finding as an issue for Graphisoft Team.

Thank you all
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.

View solution in original post

10 REPLIES 10
the code you need is in the polyline object that floats around here. its made for infinite but the code will work for you with minor adjustments
Nader Belal
Mentor
Can you be more specific, cause I found many of them and couldn't pin point which one.
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.
Jochen Suehlo
Moderator
I am not shure, if this works:
You can write the Values of the 1st Arrayparameter in a second one, then delete the 1st Arrays values and rewrite the 1st Array from the 2nd one by leaving a special value.

You can delete the Values of an Array Parameter by using something like this:
IF x THEN
DIM s[1][1]
PARAMETERS c = s
ENDIF
where c is your Array Parameter
Jochen Suehlo . AC12-27 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de
Nader Belal
Mentor
@ Joachim Suehlo

Thank you for your reply.

Well I have just tried out your trick and it didn't workout and I can't get why it doesn't !!

It's as is it refuses to just delete the array parameter (I repeat, a parameter and not a variable)
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
@Joachim Suehlo

I also tried to use the script in the Master Script, and it just doesn't delete that item.
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.
Lingwisyer
Guru
Can value masking be done outside of Complex Profiles?

!j1: Wall
!j2: Beam
!j3: Column
!j4: Handrail
!j5: Other

_profile_types = 0
if bEnableWall then _profile_types = _profile_types + 1
if bEnableBeam then _profile_types = _profile_types + 2
if bEnableColumn then _profile_types = _profile_types + 4
if bEnableRail then _profile_types = _profile_types + 8
if bEnableOther then _profile_types = _profile_types + 16

VALUES "myProfileIdx" PROFILETYPES_MASK _profile_types



Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660
Nader Belal
Mentor
@ling

I don't get it !!
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
if GLOB_UI_BUTTON_ID > 1000000 then
	n = APPLICATION_QUERY ("PARAMETER_SCRIPT", "FIRSTOCCASION_IN_PROGRESS", _isFirstRun)	!<-- prevents unnecessary consecutive entries

	if _isFirstRun then
		dim			_ap_openingLintel[][],	_ap_openingLintelHieght[][],	!<-- create dummy containers
					_ap_openingsX[][],		_ap_openingsY[][],
					_ap_openingSizeX[][],	_ap_openingSizeY[][]

		parameters	_delItem = (GLOB_UI_BUTTON_ID - 1000000),				!<-- Index of the desired opening to delete
					_count	= 1

		for _i = 2 to vardim1(ap_openingLintel) step 1
			if _i # _delItem then
				parameters	_ap_openingLintel[_i][1]		= ap_openingLintel[_count][1],
							_ap_openingLintelHieght[_i][1]	= ap_openingLintelHieght[_count][1],
							_ap_openingsX[_i][1]			= ap_openingsX[_count][1],
							_ap_openingsY[_i][1]			= ap_openingsY[_count][1],
							_ap_openingSizeX[_i][1]			= ap_openingSizeX[_count][1],
							_ap_openingSizeY[_i][1]			= ap_openingSizeY[_count][1],

							_count = _count + 1
			endif
		next _i

		parameters	ap_openingLintel		= "",
					ap_openingLintelHieght	= 0,
					ap_openingsX			= 0,
					ap_openingsY			= 0,
					ap_openingSizeX			= 0,
					ap_openingSizeY			= 0

	endif
endif


Well that is the code I have put in the "Parameter Script", and although I´m sure that GLOB_UI_BUTTON_ID > 1000000 works fine, the parameters (and not variables) do not 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.
Nader Belal
Mentor
I still have this problem that the array parameter item doesn't delete
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.