2019-06-03 02:53 PM - last edited on 2024-09-09 11:06 AM by Doreena Deng
// loop all object guids for counting int bike_count = 0; int car_count = 0; for (UIndex i = 0; i < objguids.GetSize (); ++i) { GS::Guid gsguid = APIGuid2GSGuid (objguids); API_Element element = {}; element.header.guid = objguids; err = ACAPI_Element_Get (&element); Int32 lib_idx = element.object.libInd; API_LibPart libPart; BNZeroMemory (&libPart, sizeof (API_LibPart)); libPart.index = lib_idx; err = ACAPI_LibPart_Get (&libPart); if (!err) { GS::UniString part_name = libPart.docu_UName; if (part_name=="Fahrrad Symbol 22"){ bike_count += 1; }else if(part_name=="Parkplätze Linienzug 22_b"){ API_ElementMemo memo; if (err == NoError && element.header.hasMemo) { err = ACAPI_Element_GetMemo (element.header.guid, &memo, APIMemoMask_AddPars); if (err == NoError) { UInt32 totalParams = BMGetHandleSize((GSConstHandle)memo.params) / sizeof(API_AddParType); // number of parameters = handlesize / size of single handle for (int i=0; i<totalParams ;i++){ if ((*memo.params).name == (GS::UniString) "places"){ int places = (*memo.params).value.real; car_count = car_count+places; }else{ WriteReport("param name: %s", (*memo.params).name); } } } ACAPI_DisposeElemMemoHdls (&memo); } } } }
Solved! Go to Solution.
2019-06-03 05:50 PM
2019-06-03 05:50 PM