We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2024-08-06 10:47 AM - edited 2024-08-07 06:46 AM
Hello team,
We have a use case in which we download images and create Surfaces from these images and also we create morph of few furniture object and then convert these morphs to gsm. Both these processes take some amount of time.
Is there any way in Archicad such that once the user triggers the add-on , we will render basic elements(like walls, slabs these does not take time) And show a pop up to the user saying furniture and material creation would take time and would be done in the background?
Update: Will using the communication manager improve the performance? Can we assume that morph to gsm conversion would happen parallely
2024-08-07 03:03 PM
Take a look at the functions for a ProcessWindow, e.g. ACAPI_ProcessWindow_InitProcessWindow. They allow you to display the standard Archicad progress meter with custom messages.
2024-08-09 10:55 AM
@Ralph Wessel thank you for the response. We already have a progress window. In the process, we create walls, slabs, a few other elements. But all this gets rendered in the UI after the command handler execution is completed. We managed to notice that when we invoked theACAPI_LibPart_RegisterAll() with a Zombie Lib Part in the array, it rendered the elements we had created so far. Example video: https://www.loom.com/share/44f1fc775fe447558f4b8e8cb3aa4b4a?sid=792a520d-a301-43f5-b863-5c55bcd54ddc At 6th second is where we invoked the RegisterAll() function which caused the walls and doors to be shown.
However the UI cannot be used still until the AddOn execution is completed. Is there something that can be done so that the remaining elements get rendered in the background? What does the function ACAPI_AddOnAddOnCommunication_CallFromEventLoop do? Does this execute the registered method from another add-on?
2024-08-09 04:28 PM
Sorry, I don't know a way to work around this. I think the fundamental issue is that database operations in Archicad essentially run on a single thread. I don't think you can write new objects to the project on another thread while the UI (and user) works on the main thread - I expect it would crash.
There might be a way to drip-feed the process through a kind of cooperative multitasking, but I've never tried. Possibly someone in GS knows if this is possible - but in general add-ons block the UI while running.