cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Developer forum

Renaming marker elements?

Erenford
Booster
Hello,

I'm trying to rename an elevation marker element, but it seems nothing is happening to the element. There is no error in "ACAPI_Element_Change()" but the id/name doesn't change.

The code is below. I've also tried section/interior elevation, same thing happens, with memo or without memo. Another way I could think is renaming the navigator item of the marker, but "APIEnv_ChangeNavigatorViewID()" crashes (seems renaming in navi in Project Map is not allowed?)

	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();
	}
Archicad 25 5010 INT FULL
Visual Studio Professional 2019
Win 10 Pro 64-bit
Intel Core i7-4790 CPU @ 3.60GHz
0 REPLIES 0

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!