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.

IFCAPI::GetObjectAccessor's problem.

YONGWOO KIM
Participant

I previously left an inquiry regarding ExternalGlobalId.

https://community.graphisoft.com/t5/Archicad-C-API/I-have-a-problem-when-I-release-ExternalGlobalId/...

 

Problem 1

I tried to use it without ExternalGlobalId but still have the same problem.

If IFCAPI::GetObjectAccessor().GetIFCType(objectID.Unwrap())'s or or IFCAPI::GetObjectAccessor().GetGlobalId(objectID.Unwrap())'s ok_ is false, I got an access error.

The error occur in 'ACAPI::Result<GS::UniString, ACAPI::Error>::~Result<GS::UniString, ACAPI::Error>()' and 'ACAPI::details::Storage<GS::UniString, ACAPI::Error>::destroy(ACAPI::details:;err_tag__formal)'.

This is the same as ExternalGlobalId.

I tried to solve it using try-catch but it doesn't work.

void GetIFCTypeID(API_Guid elemGuid, GS::UniString& ifcType, GS::UniString& ifcIdStr)
{
	API_Elem_Head elemHead;
	elemHead.guid = elemGuid;
	ACAPI_Element_GetHeader(&elemHead);
	auto objectID = IFCAPI::GetObjectAccessor().CreateElementObjectID(elemHead);
	if (objectID.IsOk())
	{
		auto ifcTypeResult = IFCAPI::GetObjectAccessor().GetIFCType(objectID.Unwrap());
		if (ifcTypeResult.IsOk())
		{
			ifcType = ifcTypeResult.Unwrap();

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

 

Problem 2

The object has an IFC Type and a Global ID, but GetIFCType and GetGlobalId return false.

This is parameters.

Ask_parameters.png

And this is elements's property in archicad.

Ask_object_properties.png

Unique ID is same with elemGuid.

In archicad IFC Type and GlobalId is Exist.

But, in source code, ifcTypeResult's ok_ is false.

0 REPLIES 0

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!