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 problem in upgrade AC26 to AC28

YONGWOO KIM
Participant

I try to upgrade my addon AC26 to AC28.

 

I can't find 'ACAPI_Element_GetIFCType' and 'ACAPI_IFC_APIGuidToIFCGuid'.

 

When I change objects's parameter, I was change material index with short.
But in AC28, index change to API_AttributeIndex.

How to change API_Attribute to short? ToInt32_Deprecated is this right?

2 REPLIES 2
LChen
Graphisoft
Graphisoft

Hi, I'd suggest you to check the API Example code (IFC_Test/IFCAPI_Test.cpp), which using GetIFCType().

Yes, you can use ToInt32_Deprecated() to have short value.

HTH.

Thank you for your help.

 

I find the way to get IFC type and global ID.

 

But it throws an access violation error. (0xC0000005: 0xFFFFFFFFFFFFFFFF )

 

It looks like it's an error that occurs when freeing externalGlobalId.

 

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();
	}
}

 

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!