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

load add-on automatically after file is finished opening

Anonymous
Not applicable
Right now, our ArchiCAD plugin seems to only be loaded after the user has interacted with the UI for our plugin in ArchiCAD. We'd like some functionality to occur right after a file is loaded without requiring the user to interact with our plugin's menu. Is this possible to do?

We've tried calling ACAPI_Notify_CatchProjectEvent within the RegisterInterface function, but it returns the error APIERR_REFUSEDCMD.

I tried this on ArchiCAD 19.

Thanks,
Ian
1 REPLY 1
Erenford
Booster
On CheckEnvironment() return APIAddon_Preload instead of APIAddon_Normal. This will load all three functions (CheckEnvironment(), RegisterInterface(), Initialize()) during startup of AC instead of the usual two (CheckEnvironment() and RegisterInterface()).
IanTr wrote:
We've tried calling ACAPI_Notify_CatchProjectEvent within the RegisterInterface function, but it returns the error APIERR_REFUSEDCMD.
There are functions that are not usable in CheckEnvironment() or RegisterInterface(), thats why they return APIERR_REFUSEDCMD. I'm guessing since these functions start when the project haven't fully loaded yet it won't have any project events to catch.


Initialize() can handle ACAPI_Notify_CatchProjectEvent (docu says so), but I'm not sure about other functions like ACAPI_Database or ACAPI_Environment.

Also don't forget to use ACAPI_KeepInMemory(true) else it might unload the addon at the wrong time.

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!