2014-11-20 10:35 AM - last edited on 2023-08-01 01:58 PM by Doreena Deng
GSErrCode err = NoError; API_Element elem_elev; GS::Array<API_Guid> elemList; ACAPI_Element_GetElemList(API_ElevationID, &elemList); size_t count = elemList.GetSize(); for (short e = 0; e < count; e++) { BNZeroMemory(&elem_elev, API_ElementSize); elem_elev.header.typeID = API_ElevationID; elem_elev.header.guid = elemList; err = ACAPI_Element_Get(&elem_elev); if (err != NoError) { WriteReport("[Error] %s "__FUNC__" - ACAPI_Element_Get()", ErrId2Name(err)); continue; } GS::UniString name = elem_elev.elevation.segment.cutPlName; if (name != "ELEVATION 1") continue; API_ElementMemo memo; BNZeroMemory(&memo, sizeof(memo)); err = ACAPI_Element_GetMemo(elemList, &memo); if (err != NoError) { WriteReport("[Error] %s "__FUNC__" - ACAPI_Element_GetMemo()", ErrId2Name(err)); continue; } API_Element mask; ACAPI_ELEMENT_MASK_CLEAR(mask); ACAPI_ELEMENT_MASK_SET(mask, API_ElevationType, segment.cutPlIdStr); ACAPI_ELEMENT_MASK_SET(mask, API_ElevationType, segment.cutPlName); GS::ucscpy(elem_elev.elevation.segment.cutPlIdStr, L"TEST"); GS::ucscpy(elem_elev.elevation.segment.cutPlName, L"CHANGE NAME"); ACAPI_OpenUndoableSession("TEST"); GSErrCode err = ACAPI_Element_Change(&elem_elev, &mask, &memo, APIMemoMask_All, true); if (err != NoError) { WriteReport("[Error] %s "__FUNC__" - ACAPI_Element_Change()", ErrId2Name(err)); } ACAPI_CloseUndoableSession(); }