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

Silent Rendering By code

Anonymous
Not applicable
Hi,
I'm trying to write a function that renders a couple of images using CineRender.
In order to do so, i used the API_Automate's Do_PhotoRender function, and added the relevant parameters. It works great.

The only problem, is that while rendering, AC is "stuck" until the end of the rendering process. This is different from using the Rendering function in the creative imaging tab. In the "PhotoRender Projection" function, i can work while the program is rendering.

Any idea on how to tackle this issue? Is there a way to render without getting the whole program stuck?

Thanks a lot!
Ido
4 REPLIES 4
leilei
Enthusiast
Hi,this function can help you :ACAPI_Command_CallFromEventLoop
Anonymous
Not applicable
Hi,
Thanks for the quick response!
Could you elaborate more on how to use it?
I tried using it to call my own rendering function (in silent mode), that contains ACAPI_Automate's Do_photoRender. It worked well, but once the Do_photoRender is called, it still gets the computer stuck.
I suspect that it might be because of the params sent to the CineRender addon (using ACAPI_Automate), which are probably not silent.
If so- Do you know how to get the CineRender's mdid and cmdid, so i. Could do it by myself?
If not, am i missing something? Is there another way to use it?

Thanks!!
leilei
Enthusiast
You can perform rendering in multi-threading,and this function with no crash in multi-threading to operate the AC database: ACAPI_Command_CallFromEventLoop.The Api doc has a demo with multithreading operate.
Anonymous
Not applicable
Thanks a lot, Leilei.
I've started to implement the example and I'm starting to get the hang of it.
I currently have a function that creates a new thread, and in the new thread calls the rendering function. It seems to be working alright.

The problem is that even though the rendering function is on a new thread, AC still seems to be stuck. It looks like the new thread can't work simultaneously with the main thread.

Any idea on how to get over this problem? Is there a way for me to use both threads asynchronously using the GS:Thread class? Or a different class? Maybe I'm understanding the problem wrong?

And again, thanks for all the help