Learn to manage BIM workflows and create professional Archicad templates with the BIM Manager Program.
a week ago
- last edited
Tuesday
by
Laszlo Nagy
Good day to everybody. I have a struggle with retrieving the whole data about wall composites that exist in an Archicad project.
Here is the empty Archicad project:
and here is the list of wall composites:
I will be really glad if somebody tells me a way how to get all of the composites without passing an element or guid or any other data to the API. I just want to make a code that would return me the list of all existing wall composites.
Thank you in advance!
Operating system used: Windows 11
Tuesday
Thank you very much for the correction of the topic's placement
Wednesday
Hi Emkave,
This code prints the composite names to the session report (works for AC27+):
ACAPI_Attribute_EnumerateAttributesByType (API_CompWallID,
[](API_Attribute& compAttr)
{
ACAPI_WriteReport (compAttr.header.name, false);
});
For more details about handling attributes or how to do this for older AC versions you can check the "Attribute_Test" example project in the respective API DevKits.
Or feel free to ask more for more details.
Best,
Bernd
Wednesday
Hello. Thank you for the reply. Is there a function for archicads of versions 26 and below?
Wednesday - last edited Wednesday
Something like this should work in <=AC26 (not tested):
API_AttrTypeID typeID = API_CompWallID;
API_AttributeIndex num = 0;
GSErrCode err = ACAPI_Attribute_GetNum (typeID, &num);
if (err != NoError) { return err; }
for (API_AttributeIndex id = 1; id <= num; ++id) {
API_Attribute attr{};
attr.header.typeID = typeID;
attr.header.index = id;
GS::UniString tmpUniString;
attr.header.uniStringNamePtr = &tmpUniString;
err = ACAPI_Attribute_Get (&attr);
if (err == APIERR_DELETED || err == APIERR_BADINDEX) { continue; }
if (err != NoError) { return err; }
ACAPI_WriteReport (tmpUniString, false);
}