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

Displaying Object Tool window programmatically

Lk_
Participant
Hello,
I have a library with some custom objects in it. Is there any way to command the add-on to display the 'Object Tool' window so the user can just pick the object and place it in the project? Also, if it's possible, can I highlight the contents of the library so the user would not have to look for it in the library tree?
1 REPLY 1
Lk_
Participant
So, I got the answer to the first question after extensive search and some outside help.
It turns out that I want to use ACAPI_Interface function like in the example from https://archicadapi.graphisoft.com/documentation/apiio_objectsettingsid

However, the part where it says about filtering is unclear to me because I can't get it to work. Either the filtering is not working the way I would think or I'm doing something wrong.

Here's what I already have:

void MyFunction(const uchar_t* name)
{
       API_LibPart part;
       BNZeroMemory(&part, sizeof(API_LibPart));
       lstrcpy(part.file_UName, name);
       GSErrCode err = ACAPI_LibPart_Search(&part, false);
 
       if (err == NoError)
       {
             API_ObjectSettingsPars api_objSetPars;
             BNZeroMemory(&api_objSetPars, sizeof(API_ObjectSettingsPars));

             api_objSetPars.elemDef.header.typeID = API_ObjectID;
             CHCopyC(part.ownUnID, api_objSetPars.subtypeID); 

             err = ACAPI_Interface(APIIo_ObjectSettingsID, &api_objSetPars);
 
             if (err == NoError)
             {
                   // do sth with the element
             }
       }
}
The window pops up but there's no filtering at all. It just shows everything that's in the whole library (chairs, tables and other decorative stuff).

Could someone help me from here, please?