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.

Get object's properties in Archicad 26 and 28

Emkave
Booster

Hello everyone. I am stuck with one issue related to extracting elements' data like width, height, length and so on.
I have been looking around in Archicad 28 API, however, some functions are about to be deleted, or deprecated, or replaced, or some do not have example to see how it works...

 

I have object's guid and libind, but I am not sure which functions to use.


I'd like to know your ways of extracting such information from a selected object in Archicad, and I'd be glad if you would provide the ways to do that for AC 26 and 28.

 

P.S. I do not want to retrieve IFC parameters.

Thank you a lot in advance!

 

Operating system used: Windows 11

7 REPLIES 7
Ralph Wessel
Mentor

Do you want he width, height etc for a specific type of element, e.g. a wall, slab etc, or a generic method for any kind of element? if you just need the bounding box of any element you could use ACAPI_Element_CalcBounds.

Ralph Wessel BArch
Software Engineer Speckle Systems

Hi. Yes, I am interested in stuff you listed in the first question!

Ralph Wessel
Mentor

You mentioned that there are some API functions have been deleted/deprecated/etc. Are these functions you have already been using? If so, it would helpful to see what you have already done - it might help me understand what you want to do.

 

Otherwise, the simplest approach would be to directly use the data in API_Element to extract the data you want. For example, if you have a wall in an API_Element structure like so:

API_Element element;

…you could obtain/calculate the following:

  • length using the wall origin (element.wall.begC)  and end point (element.wall.endC);
  • thickness using element.wall.thickness;
  • height using element.wall.height;

Does this help?

Ralph Wessel BArch
Software Engineer Speckle Systems

Yes, some functions like: ACAPI_LibraryPart_GetParams() are marked as "Legacy function - to be deleted in future versions, use ACAPI::LM::GSMObject::GetParameters instead".

I went to check for "ACAPI::LM::GSMObject::GetParameters" and found this:

Emkave_0-1731937106999.png


So far I checked out these functions:
ACAPI_LibraryPart_GetSection(),
ACAPI_Element_GetComponents(),
ACAPI_Element_GetMemo(),
ACAPI_LibraryPart_GetParamValues(),
API_Element(),
ACAPI_LibraryPart_GetActParameters()

But none of them gave me these information:

Emkave_2-1731938219599.png

 

So I wonder if you managed to extract these data somehow


 
 

 

 

Ralph Wessel
Mentor

Do you want this information solely for objects, i.e. instances of a library part placed in a project? Or potentially for other elements like walls, slabs etc?

Ralph Wessel BArch
Software Engineer Speckle Systems

Yes, for now only the instances that are placed in a project.

Ralph Wessel
Mentor

Have you looked at the functions associated with ACAPI_LibraryPart_OpenParameters? Take a look at the example project 'Element_Test', specifically the function 'Do_ShowSymbolHotspots' in 'Element_Snippets.cpp'. This uses 'ACAPI_LibraryPart_OpenParameters', 'ACAPI_LibraryPart_GetActParameters' etc

The documentation for ACAPI_LibraryPart_OpenParameters also has some sample code.

Ralph Wessel BArch
Software Engineer Speckle Systems

Setup info provided by author