The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

Everything about GDL - Doors/Windows/Objects/Stairs etc. (Example: I created an object that prints an error message in 3D all the time, please help!)

Moderators: ejrolon, Barry Kelly, Karl Ottenstein, LaszloNagy, gkmethy, Gergely Feher

By Nagy Zsolt
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.

(2.37 KiB) Downloaded 22 times
By sinceV6
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 [i] 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.
By Nagy Zsolt
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!