Author:Erenford
Posted: Wed Nov 08, 2017 10:57 am (GMT+1)
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()).
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.
_________________
Archicad 20 6005 INT FULL
Win 7 Pro SP 1 64-bit
Intel Core i7-2600 CPU @3.40GHz
Posted: Wed Nov 08, 2017 10:57 am (GMT+1)
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.
_________________
Archicad 20 6005 INT FULL
Win 7 Pro SP 1 64-bit
Intel Core i7-2600 CPU @3.40GHz