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

Dynamic arrays in gdl obejct

Anonymous
Not applicable
Hi All!

Attach my gdl object, please check it.

I have an origo, and some drawing element with hotspots. User can move and adjust each element. When element hotspot move to origo, element can be deleted. The concept base on dynamical arrays (thanks Esteban Ramos).

The base functions (move, adjust, delete) work, but when you delete any but the last element of array, other element's parameter (width, depht, heigth, etc.) won't be correct.

Thanks!
2 REPLIES 2
sinceV6
Advocate
Hi.
A quick look indicates that you are running into one problem I had with the polyline script: when one of the elements disappears, you are reducing from the very beginning of the arrays, effectively moving all values and thus changing the output order.

You can try to verify this visually in the working object by adding a simple text with an ID based on from the loops.

In order for this to work like you want, you would need to identify the hotspot being moved to the origin, and make array adjustments from there.

Since these are independent things ("holes" in this case), I don't think that reducing arrays is necessary. You can just state that if the coordinates of the base hotspot for a specific value are < EPS, then don't draw the element, but leave the editable hotspot in the origin. If the user then moves it again, use its values. You could always have a new editable hotspot in the origin to create new elements on the fly.

You are also missing a default size value for new elements (when nr is increased, elements don't have a defined size)

Hope that helps a bit.
Best regards.
Anonymous
Not applicable
Thanks sinceV6!

You are right, don't need dynamic array, but this is perfect solutions:)

Beta solution: can delete only the last element.

I try check the program with helper tags with ID.

Best regards!
Zsolt