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

Streamline your workflows and master BIM coordination! Program starts April 28!

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

I have a problem when I release 'ExternalGlobalId'

YONGWOO KIM
Participant

I have some problem to get 'ExternalGlobalId' and 'GlobalId' in ArchiCAD28.

 

I want to get 'ExternalGlobalId', if there 'ExternalGlobalId' is exist.

 

And, if 'ExternalGlobalId' is not exist, I want to get 'GlobalId'.

 

An error occurs when exiting the for loop.

Occurs only when 'ExternalGlobalId' is not present.

 

In 'Microsoft Visual Studio\2019\Professional\VC\ToolsMSVC\14.29.30133\include\xmemory'.

0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF

ExternalGlobalId_stack.png

 

This is my code.

 

for (int i = 0; i < selList.GetSize(); i++)
{
	UniString ifcType = L"", ifcIdStr = L"";

	API_Elem_Head elemHead;
	elemHead.guid = selList[i].GetGuid();
	ACAPI_Element_GetHeader(&elemHead);
	auto objectID = IFCAPI::GetObjectAccessor().CreateElementObjectID(elemHead);
	auto ifcTypeResult = IFCAPI::GetObjectAccessor().GetIFCType(objectID.Unwrap());
	if (ifcTypeResult.IsOk())
		ifcType = ifcTypeResult.Unwrap();

	auto externalGlobalId(IFCAPI::GetObjectAccessor().GetExternalGlobalId(objectID.Unwrap()));
	if (externalGlobalId.IsOk())
	{
		ifcIdStr = externalGlobalId.Unwrap();
	}
	else
	{
		auto globalId = IFCAPI::GetObjectAccessor().GetGlobalId(objectID.Unwrap());
		if (globalId.IsOk())
			ifcIdStr = globalId.Unwrap();
	}
}

 

0 REPLIES 0