We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2018-02-09 11:16 AM - last edited on 2023-07-12 05:50 PM by Doreena Deng
API_Element element; vector <elementsList> eL; GS::Array<API_ElemTypeID> typeIDs = {API_WallID, API_SlabID, API_RoofID}; // the types we are going to look for for(int i=0; i < typeIDs.GetSize(); i++){ GS::Array<API_Guid> elemListGuid; ACAPI_Element_GetElemList (typeIDs, &elemListGuid); // get the elements for each type for(int k=0; k < elemListGuid.GetSize(); k++){ WriteReport("element number %i", k); GSErrCode err2; BNZeroMemory (&element, sizeof (API_Element)); element.header.typeID = typeIDs; element.header.guid = elemListGuid.Get(k); // GUID OF EACH ELEMENT err2 = ACAPI_Element_Get (&element); // GETTING THE ELEMENT ??? if (err2 != NoError) { WriteReport_Alert ("Unknown element"); return; } else{ // we have element! } API_Attribute attrib; GSErrCode err3; BNZeroMemory (&attrib, sizeof (API_Attribute)); attrib.header.typeID = API_CompWallID; attrib.header.index = element.header.layer + 1; err3 = ACAPI_Attribute_Get (&attrib); if (err3 == NoError){ WriteReport_Alert("BINGO!! name is %s", attrib.header.name); // HERE IT ALWAYS PRINTS THE FIRST ELEMENT COMPOSITE NAME... } } }
2018-02-09 02:43 PM
if(typeIDs == API_WallID){ // Its a wall compIndex = element.wall.composite; } if(typeIDs == API_SlabID){ // Its a slab compIndex = element.slab.composite; } if(typeIDs == API_RoofID){ // Its a roof compIndex = element.roof.shellBase.composite; }