cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Archicad C++ API
About Archicad add-on development using the C++ API.

Lazy Loading support in Archicad

kency
Enthusiast

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

3 REPLIES 3
Ralph Wessel
Mentor

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.

Ralph Wessel BArch
Software Engineer Speckle Systems

@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?

Ralph Wessel
Mentor

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.

Ralph Wessel BArch
Software Engineer Speckle Systems