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

Question about ACAPI_SetPreferences and IO::Memory

julienK
Advocate

I implemented in my addon the method shown in the  maze generator part 3 tutorial of the API blog.

 

I have several dialogs  in my addon so I tried implementing  a set of settings  and preferences handling for each of my dialogs and palettes.

However  this didn't quite work. Even though each dialog  use  their own functions with different names when I go from one dialog to the other  they seem to overwrite each others settings.

Using only on set of settings and preferences handling common to all dialogs and palettes fix the issue but I'll end up with hundreds of variables that get handled for no reason if i use a dialog that only needs a few of them.

 

My question  is:

Are we  limited to  one Memory channel  and set of settings per addon ?  Or is there a way to get several?

 

I tried  the method were each dialog has its own set to limit the number of settings but the only way to get everything working at the moment is to use only one.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Hi Julien,

To my understanding, there's only one channel for PREFERENCE settings per Add-On as you've discovered.

But you can store several independent settings (e.g. per Dialog) into the project itself.
The difference is briefly explained in the beginning of the tutorial you mentioned (Archicad Maze Generator Add-On Tutorial; Part 3). It's mentioned there, that the data stored with the project itself will be uploaded to the teamwork server, which could be weird for dialog settings. But there are also client-only AddOn-Objects to store data with the project. Check out: https://archicadapi.Graphisoft.com/documentation/addonobject-manager and specifically https://archicadapi.Graphisoft.com/documentation/acapi_addonobject_createclientonlyobject.

Another idea would be, to use the preference data but use the Input/Output channels more like random access memory. I think the memory channels support offsets. So you wouldn't need to handle variables not related to the current context.

Hope this helps,
Bernd

View solution in original post

2 REPLIES 2
Solution

Hi Julien,

To my understanding, there's only one channel for PREFERENCE settings per Add-On as you've discovered.

But you can store several independent settings (e.g. per Dialog) into the project itself.
The difference is briefly explained in the beginning of the tutorial you mentioned (Archicad Maze Generator Add-On Tutorial; Part 3). It's mentioned there, that the data stored with the project itself will be uploaded to the teamwork server, which could be weird for dialog settings. But there are also client-only AddOn-Objects to store data with the project. Check out: https://archicadapi.Graphisoft.com/documentation/addonobject-manager and specifically https://archicadapi.Graphisoft.com/documentation/acapi_addonobject_createclientonlyobject.

Another idea would be, to use the preference data but use the Input/Output channels more like random access memory. I think the memory channels support offsets. So you wouldn't need to handle variables not related to the current context.

Hope this helps,
Bernd

julienK
Advocate

Thanks a lot Bernd, I'll look into that.