Learn to manage BIM workflows and create professional Archicad templates with the BIM Manager Program.

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

Get all wall composites

Emkave
Booster

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:

 

Emkave_0-1739533001391.png

 

and here is the list of wall composites:

Emkave_1-1739533101190.png

 

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

13 REPLIES 13

Thank you very much for the correction of the topic's placement

 
 

 

 

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

Hello. Thank you for the reply. Is there a function for archicads of versions 26 and below?

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);
}

 

Setup info provided by author