2018-03-05 04:40 AM - last edited on 2023-07-12 05:48 PM by Doreena Deng
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 :'(
2018-03-05 12:57 PM
2018-03-06 01:43 AM
2018-03-06 09:35 AM
Twily wrote:
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.
2018-03-06 10:07 AM
Ralph wrote:
ACAPI_LibPart_Registereffectively includes the gsm in the loaded library – you can't work with it otherwise. The value of libpart.indexis the object's index in the loaded library.
Do you get an error code returned fromACAPI_LibPart_Register?
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
2018-03-07 10:38 AM
Twily wrote:That error is
result is
Register Error : -2130313214
Create Error : -2130312314
I tried to find the error code but i can't find :'(
2018-03-07 11:07 AM
Ralph wrote:yes, i'm testing to menu item click.Twily wrote:That error is
result is
Register Error : -2130313214
Create Error : -2130312314
I tried to find the error code but i can't find :'(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?
2018-03-08 02:44 PM
Twily wrote: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.
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.