We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Archicad C++ API
About Archicad add-on development using the C++ API.

Can't  get the two ids of the column element

WalterWhite
Contributor

Can't  get the two ids of the column element, only the GUID

 

13 REPLIES 13
Barry Kelly
Moderator

What 2 IDs - Element ID and GUID?

 

Where are you trying to get this information?

Autotext labels, GDL, API (add-ons), schedules?

Let me know and I will move this post to the appropriate forum.

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
WalterWhite
Contributor

C++ API(add-ons)

Can't  get the Element ID 

Element ID's are specific properties.

Try something like this:

const API_Guid ELEMID_PROP_GUID = APIGuidFromString ("7E221F33-829B-4FBC-A670-E74DABCE6289");

API_Property prop;
GSErrCode err = ACAPI_Element_GetPropertyValue (elementGuid, ELEMID_PROP_GUID, prop);
if (err != NoError) { return err; }

ACAPI_WriteReport("Element ID: " + prop.value.singleVariant.variant.uniStringValue, true);

Thank you, I will try it, but now there is another problem. When adding a column in the scene, I will get two element, I don't know how to get ID separately.

  ModelerAPI::Model* m_model;
  Int32 nElements = m_model->GetElementCount();

Snipaste_2024-10-01_17-21-37.png

I find that one element id in the column is GUID, what is the relationship between the other element id and Guid?

I haven't used the ModelerAPI yet, but I don't think it helps you in your case (if I understand correctly what you want to do).

Instead check out these two functions and their examples:
ACAPI_Element_Get

ACAPI_Element_GetElemList

 

GUID is a unique identification number for each element. With Element ID I usually refer to the property which is usually something like "COL - 001".
And on top of that, the Element ID is a built-in property which has it's own GUID. That's also very confusing.

The question really is which information you want exactly. Maybe you can make a screenshot of the information as you see it in the Archicad Window, then we can tell you how to get it with the API.

My ultimate goal is to get the model information for columns, such as Polygon, Vertex. These cannot be obtained directly from the Guid.

I can only get one Guid for the column through ACAPI_Element_GetElemList.
With m_model->GetElementCount(), I find that the column consists of two elements, and then use GetElemGuid() to find that each of them has a different Guid.
I am currently using notification management ElementEventHandlerProc, when APINotifyElement_New, the column will return one Guid and the other Guid will not return, what is the way to get it?
I think it might not be an Element ID, but a column with two Guids, judging from the interface GetElemGuid().