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

GDL Registration Archicad 27

Vincent Schmitt BIMm
Contributor

Hello,

 

we are currently updating our plugin to Archicad 27. Sadly, some of our functions don't work as before:

We are creating GDL Objects from an XML at runtime via the LP_XMLConverter provided by Archicad. To place these objects, the GDL Files have to be registered. In the past we did this with ACAPI_LibPart_RegisterAll (which is now called ACAPI_LibraryPart_RegisterAll).

With the update to AC27 a lot of weird stuff happens. For example, the objects can't get placed after they get registered for the first time, but they can be placed when you do the same procedure again. Sometimes it even places random AC objects.

We think that it has to do with the registration process, even though it does not throw an ErrorCode, because placing Objects that are already registered works flawlessly.

Has there been any change to the way objects have to be registered or placed in AC 27? We could not find any information in the documentation.

I'm sorry for the vague description of our problem, but at this point we are not able to precisely locate the problem or reproduce certain behaviours.

Thank you for your help!

2 REPLIES 2

Hi Vincent,

 

It's weird behavior! I haven't experienced it yet myself, but I have found a lot of issues with library parts can happen if you place them in TW libraries or the embedded library. So I'm curios if you experience the issues also in libraries which are not the embedded library and not a TW library?

 

Best,
Bernd

Hello Bernd,

I am a collegue of Vincent and we have found the source of error.
Unfortunately we don't know yet, why it happens.
When registering .gsm files the returned libpart.index will change when trying to place it. Here is some example code:

GS::Array<API_LibPart> libParts;
for (auto& location : locations) {
	API_LibPart libPart;
	BNZeroMemory(&libPart, sizeof(API_LibPart));
	libPart.typeID = APILib_ObjectID;
	libPart.location = &location;
	libParts.Push(libPart);
}
ACAPI_LibPart_RegisterAll(&libParts);
// libPart.index is "6415"
			
// ================================= Other Function =================================
			
API_LibPart libPart;
BNClear(libPart);
CHCopyC(ownUnIDString, libPart.ownUnID);

ACAPI_LibraryPart_Search(&libPart, false);

// libPart.index is "334"
// Placement with the new index then works, but wouldn't be that clean 😉

 Maybe someone from Graphisoft can help us out, @akomporday  ?

"So I'm curios if you experience the issues also in libraries which are not the embedded library and not a TW library?"

The library in question is a local folder next to the .pln, so neither of those two.