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

(Really) Dynamic arrays as parameters of GDL objects

Sam Karli
Enthusiast
I am trying to make objects that are swept through an user-given polygon, like railings. Since it doesn't seem to be possible to give the GDL a polygon as a parameter I gave it through an array (of points). But I can give it only a pre-limited number of points (ie. 4, or 5 or 20 points alltogether).

The GDL docs says that parameter arrays are dynamic by default, that is they can be extended, and it works. But the parametric arrays' stored size cannot be changed, and I cannot change in the parameter window.

Is it possible to change the parameter array's size somehow?
GDL/Python/C++ dev
2 REPLIES 2
ztaskai
Graphisoft Alumni
Graphisoft Alumni
You definitely cannot do out of bounds indexing of array parameters for reading in the 2D/3D scripts.

But you absolutely can do the following in the parameter script:
if max (gs_sh, gs_sho, gs_shu) > vardim2(gs_horGridY) then
	parameters gs_horGridY[1][max (gs_sh, gs_sho, gs_shu)] = 0
	parameters gs_horGridBegX[1][max (gs_sh, gs_sho, gs_shu)] = 0
	parameters gs_horGridEndX[1][max (gs_sh, gs_sho, gs_shu)] = 0
endif
(the code snipplet is from the standard German AC windows)

In other words: you can extend your array parameters by simply setting the last item to create.

Decreasing the size of the array (which is a much rarer need) can be done by creating a new smaller array, copying the necessary values and setting the array parameter to the new array using the PARAMETERS command.
Zsolt Táskai
ArchiCAD Development - GDL Team
AC13, AC14 and upwards...
Pertti Paasky
Advocate
Try
http://archicad-talk.graphisoft.com/object_depository.php
Free form Window in Windows category
Needs time and effort to understand.
- AC-24 FIN - WIN 10 - HP Zbook -
“A winner is just a loser who tried one more time.”
George M. Moore, Jr.