The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

Discussions about using GRAPHISOFT's tools (API DevKit) for independent software developers

Moderators: Barry Kelly, Karl Ottenstein, LaszloNagy, ejrolon, gkmethy, Tibor Lorántfy, MOREH Tamas, Akos Somorjai, Ed Brown, Mihály Palenik

#278352
Hi everyone,


i'm tried from figure out to get thumbnail and parameters from external library part but failed.

For example :
Code: Select all IO::Location fileLoc("C:\\Users\\W.C.SHIM\\Downloads\\test.gsm"); API_LibPart libPart; BNZeroMemory(&libPart, sizeof(API_LibPart)); libPart.typeID = APILib_ObjectID; libPart.location = &fileLoc; ACAPI_LibPart_Register(&libPart);
but it doesnt work :'(

so... can i do this?
#278361
The quoted code should register the library part with ARCHICAD as part of the loaded library. Does that work, i.e. does it return NoError and is libPart.index non-zero?

If so, use the returned index to call ACAPI_LibPart_GetSectionList. The parameters, scripts and preview image are all stored in the returned sections. Each section has an ID for the data it contains, e.g. the parameters ID is API_SectParamDef and the preview image is API_SectInfoGIF.
#278413
oooo... my mistake :'( i want load a .gsm file. not use part of the loaded library
(just open and use gsm file programmatically)
i tried ACAPI_LibPart_Create and ACAPI_LibPart_Register. but libpart.index is always 0.
ACAPI_LibPart_Register effectively includes the gsm in the loaded library – you can't work with it otherwise. The value of libpart.index is the object's index in the loaded library.

Do you get an error code returned from ACAPI_LibPart_Register?
#278419
ACAPI_LibPart_Register effectively includes the gsm in the loaded library – you can't work with it otherwise. The value of libpart.index is the object's index in the loaded library.

Do you get an error code returned from ACAPI_LibPart_Register?

I tried this :
Code: Select all IO::Location fileLoc("C:\\Users\\W.C.SHIM\\Downloads\\test.gsm"); API_LibPart libPart; GSErrCode err = NoError; BNZeroMemory(&libPart, sizeof(API_LibPart)); libPart.typeID = APILib_ObjectID; libPart.location = &fileLoc; err = ACAPI_LibPart_Register(&libPart); if (err != NoError) { char msgStr[256]; sprintf(msgStr, "Register Error : %d", (int)err); ACAPI_WriteReport(msgStr, true); } err = ACAPI_LibPart_Create(&libPart); if (err != NoError) { char msgStr[256]; sprintf(msgStr, "Create Error : %d", (int)err); ACAPI_WriteReport(msgStr, true); }
result is

Register Error : -2130313214
Create Error : -2130312314

I tried to find the error code but i can't find :'(
#278467
result is
Register Error : -2130313214
Create Error : -2130312314
I tried to find the error code but i can't find :'(
That error is APIERR_MEMFULL (Insufficient memory), which is odd. In what context are you trying to register the library part, e.g. in response to a menu item click?
#278471
result is
Register Error : -2130313214
Create Error : -2130312314
I tried to find the error code but i can't find :'(
That error is APIERR_MEMFULL (Insufficient memory), which is odd. In what context are you trying to register the library part, e.g. in response to a menu item click?
yes, i'm testing to menu item click.
But later i will use immediately after open archicad.


I want this method (in automatically) :

after open archicad (load addon) ->
load gsm file ->
get thumbnail and parameters ->
close gsm file.
#278524
yes, i'm testing to menu item click.
But later i will use immediately after open archicad.
I want this method (in automatically) :
after open archicad (load addon) ->
load gsm file ->
get thumbnail and parameters ->
close gsm file.
That code should work in the right context – it looks practically identical to the documentation example. Perhaps try building one of the example projects – LibPart_Test – that uses this function. See if it works in that context and work back from there.