3 weeks ago
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 weeks ago
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.
2 weeks ago
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();
}
}