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.

How export API_LibPart GSM on computer

LVirone Greisch
Contributor

Hello,

 

I successfully create a GSM object in Archicad Library, but I don't find a way to export it (or directly create it) on my computer.

 

Currently, I set the API_LibPart.location in the embeddedLibrary. I tried to set the location on a computer folder and it doesn't work (I get an error -2130312314), I suppose I need to create it in Archicad before exporting it, am I correct?

Virone Lorenzo
4 REPLIES 4
Oleg
Expert

I dont understood your issue exactly, so just a reply about the error code.

See ErrorCodes page of API documentation.
Error -2130312314 means APIERR_NESTING "The API function is not reentrant. Nesting occurred."

I think it is not location issue.

Hello and thanks for the reply.

 

I've the error -2130313215 the first time I execute my code, then -2130312314 all the next time in the same Archicad instance.

 

The base of my code come from Speckle connector for Archicad, their methods GetLocation() and CreateSubFolder() work fine to create a library part in the embedded library, it failed when I try to set a Windows path. Source code: https://github.com/specklesystems/speckle-archicad/blob/release/3.0.0/AddOns/Speckle/Sources/AddOn/C...

 

The code I tried:

 

API_LibPart libPart;
BNClear(libPart);
BNZeroMemory(&libPart, sizeof(API_LibPart));
libPart.typeID = APILib_ObjectID;
libPart.isTemplate = false;
libPart.isPlaceable = true;

//Location part
IO::Location* loc = new IO::Location();
loc->Set(GS::UniString("D:\\Test")); //The path I want
libPart.location = loc;

CHCopyC("{57B7C584-5C0D-11D6-A0D8-036F034B6791}-{00000000-0000-0000-0000-000000000000}", libPart.parentUnID); // General Stair subtype
GS::ucscpy(libPart.docu_UName, L("Test LibPart")); //library part name

ACAPI_LibraryPart_Create(&libPart); //This method return the error
Virone Lorenzo
Oleg
Expert

Hi

Is this all your code for test ?

PS: 
LibPart creation is a building process, starts by ACAPI_LibraryPart_Create and ends by ACAPI_LibraryPart_Save.
LibPart's sections are created between them.
Like in Sparcle's LibpartBuilder::CreateLibPart method.

Oleg
Expert

Tried the your code above. 
But added ACAPI_LibraryPart_Save to avoid -2130312314 error.  
It works for me (although it wasn't AC28).

If I change drive letter to non-existent on my PC, I got -2130313215 error.
May be you dont have "D" drive.


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!