2024-11-14 03:29 PM - last edited on 2024-11-15 01:47 AM by Barry Kelly
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
2024-11-18 12:18 PM
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.
2024-11-18 02:23 PM
Hi. Yes, I am interested in stuff you listed in the first question!
2024-11-18 02:33 PM
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:
Does this help?
2024-11-18 03:01 PM - last edited on 2024-11-19 10:10 AM by Laszlo Nagy
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:
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:
So I wonder if you managed to extract these data somehow
2024-11-18 03:09 PM
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?
2024-11-18 03:10 PM
Yes, for now only the instances that are placed in a project.
2024-11-18 03:40 PM
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.
4 weeks ago
Hi. I think I have found the way to solve the issue by iterating the parameter array that is stored in the variable that you get from ACAPI_LibraryPart_GetActParameters(). Thanks for the help very much!