2 weeks ago - last edited 2 weeks ago
Hello,
I'm exploring whether it's possible to catch Archicad events right from Archicad startup, rather than only after triggering a command via the MenuCommandHandler method.
I've been using the methods Do_CatchProjectEvent and NotificationHandler from the sample Project_Observer.cpp provided in the API Development Kit 28.4001\Examples\Notification_Manager. Currently, I'm calling Do_CatchProjectEvent within the RegisterInterface method, but it doesn't seem to work. Specifically, the dialog triggered by ACAPI_WriteReport in NotificationHandler never appears.
It does work when I call Do_CatchProjectEvent from within a command in MenuCommandHandler.
My ultimate goal is to have Archicad generate LibraryPart (GSM) files in response to requests from an external application. To do this, I want to launch Archicad automatically and determine when it's safe to begin code execution for GSM generation (ensuring Archicad isn't busy to avoid any potential crashes). Maybe there is a method to ask Archicad if the environment is safe?
Thanks
Solved! Go to Solution.
2 weeks ago
Hi Lorenzo,
You need to call ACAPI_ProjectOperation_CatchProjectEvent (which is the function call in Do_CatchProjectEvent you were referring to) inside of the Initialize function. Calling it in RegisterInterface doesn't work.
I think the "earliest" notification you can get are APINotify_New, APINotify_NewAndReset and APINotify_Open. So whenever a project is opened/newly created.
For your ultimate goal I have two suggestions/questions:
Hope that helps,
Bernd
2 weeks ago
Hi,
In addition.
If you want to load an addon at start of archicad, you need to return APIAddon_Preload from CheckEnvirinment function.
PS:
And there is related function ACAPI_KeepInMemory.
I think, calls of ACAPI_ProjectOperation_CatchProjectEvent in the Initialize function will keep the addon in memory already.
So in this case just for info.
2 weeks ago
Hi Lorenzo,
You need to call ACAPI_ProjectOperation_CatchProjectEvent (which is the function call in Do_CatchProjectEvent you were referring to) inside of the Initialize function. Calling it in RegisterInterface doesn't work.
I think the "earliest" notification you can get are APINotify_New, APINotify_NewAndReset and APINotify_Open. So whenever a project is opened/newly created.
For your ultimate goal I have two suggestions/questions:
Hope that helps,
Bernd
2 weeks ago
Hi,
In addition.
If you want to load an addon at start of archicad, you need to return APIAddon_Preload from CheckEnvirinment function.
PS:
And there is related function ACAPI_KeepInMemory.
I think, calls of ACAPI_ProjectOperation_CatchProjectEvent in the Initialize function will keep the addon in memory already.
So in this case just for info.
2 weeks ago
Thanks for your very useful informations ! The LPXML_Converter is the perfect tool for what I need, I don't even need to "pilot" Archicad !
Is it possible to debug GDL script using LPXML_Converter ?
Hi@Oleg,
Thank you for your useful addition !
2 weeks ago
Glad to read that the information helps you 🙂
Unfortunately the LPXML_Converter can't really be used for debugging scripts to my understanding.
If you end up using it, I recommend to use the "hsf" format. I think it's the easiest to work with.
Tuesday
Hello again @BerndSchwarzenbacher,
There is no debugger in LPXML_Converter, but is there a way to debug GDL I write using Archicad API with ACAPI_LibraryPart_WriteSection ?
Globally, is there a way to debug GDL script using code ?
Thank you
Tuesday
I don't think there is any unfortunately! At least I'm not aware of any.