Begin your Archicad journey with our free learning path - perfect for newcomers and experienced users looking to strenghten their skills.

GDL
About building parametric objects with GDL.

Use gravity for Z position

Miha Nahtigal
Expert
My Addon creates API_Element (GDL object) on user specified coordinates acquired with APIIo_GetPointID. X and Y coordinates are ok, Z coordinate is always zero.

I would like to use gravity when picking a point on eg Mesh so Z coordinate gets populated too.

Is this possible?
BIMquants.comBETA - Quantities and Costs Estimation in Archicad - BETA testers needed.
3 REPLIES 3
Miha Nahtigal
Expert
Talking to myself a bit more...

I could use TDGetHeightAtPoint() which will "Calculate the height of a triangulated mesh at a given location."

Unfortunately one of the parameters is a list of triangles. Browsing through mesh type and its memo, I do not think I can extract them from specified existing mesh.

To go a bit further... there is also a TDTriangulate() function. Wouldn't be a bit overkill using it on already defined (and triangulated) mesh?
BIMquants.comBETA - Quantities and Costs Estimation in Archicad - BETA testers needed.
vuego wrote:
My Addon creates API_Element (GDL object) on user specified coordinates acquired with APIIo_GetPointID. X and Y coordinates are ok, Z coordinate is always zero. I would like to use gravity when picking a point on eg Mesh so Z coordinate gets populated too.
I don't know if there is a shortcut to achieving this. You could get the 3D body of the mesh from ModelAccess or the older 3D Manager (ACAPI_Element_Get3DInfo etc). You could then determine which face lies directly under the point of interest and the z level on the plane at that point.
Ralph Wessel BArch
Central Innovation
Miha Nahtigal
Expert
I've decided to change my object creation concept.

Switched from APIelement creation to new element event observer and let user use default gravity functionality of AC. API magic is fired afterwards.
BIMquants.comBETA - Quantities and Costs Estimation in Archicad - BETA testers needed.