Delete an Array's Parameter Item

Home Forums Problems and solutions in GDL Graphical UI and parameters list Delete an Array's Parameter Item

Viewing 1 reply thread
  • Author
    • #4488
      Nader Belal

      Hi everyone,

      I´m trying to create a panel that can have an arbitrary number of openings, where the user can control them all, including a delete button for its deletion.

      All data are in 1 dimensional arrays and are displayed well in the GUI, but when I try to program the delete button, the array dones’t update. Can you help to solve it.

      if GLOB_UI_BUTTON_ID >= 1000 then			!<-- activation if any delete button was pressed
      	if _isFirstRun then 
      		_newArrayLen	= vardim1(ap_openingLintel) - 1						!<-- dummy condition to force array deletion
      		openingdelItem	= (GLOB_UI_BUTTON_ID - 1000)						!<-- Index of the desired opening to delete
      		_count			= 1
      		dim			_ap_openingLintel[],_ap_openingLintelHieght[],			!<-- create dummy containers
      					_ap_openingsX[],	_ap_openingsY[],
      					_ap_openingSizeX[],	_ap_openingSizeY[][]
      		if vardim1(ap_openingLintel) # _newArrayLen then
      			for _i = 1 to vardim1(ap_openingLintel)
      				if _i # openingdelItem then
      					_ap_openingLintel[_count]		= ap_openingLintel[_i]
      					_ap_openingLintelHieght[_count]	= ap_openingLintelHieght[_i]
      					_ap_openingsX[_count]			= ap_openingsX[_i]
      					_ap_openingsY[_count]			= ap_openingsY[_i]
      					_ap_openingSizeX[_count]		= ap_openingSizeX[_i]
      					_ap_openingSizeY[_count]		= ap_openingSizeY[_i]
      					_count = _count + 1
      			next _i
      		parameters		ap_openingLintel		= _ap_openingLintel,
      						ap_openingLintelHieght	= _ap_openingLintelHieght,
      						ap_openingsX			= _ap_openingsX,
      						ap_openingsY			= _ap_openingsY,
      						ap_openingSizeX			= _ap_openingSizeX,
      						ap_openingSizeY			= _ap_openingSizeY
    • #4491
      Nader Belal

      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 ArchiCAD-Talk: LIMITING RANGE OF PARAMETER ARRAYS (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[i] = 0
      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:


      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

Viewing 1 reply thread
  • The forum ‘Graphical UI and parameters list’ is closed to new topics and replies.