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

Saving add-on data (customisation) for future Archicad sessions

dushyant
Enthusiast

Hi,

Is there a way for an add-on to save some data in a local installation, like some custom user-settings, that could be loaded the next time the add-on loads?

 

Thanks.

3 REPLIES 3
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni

Yes, the Add-On can store custom data in user preferences. See this tutorial: https://archicadapi.graphisoft.com/Archicad-maze-generator-add-on-tutorial-part-3

 

Let me quote from that tutorial blog post:


Archicad API provides support to store data in several places:
  • The preferences file: The data will be linked to the user’s computer, not the database. It means it will be the same regardless the actual plan file the user is working on.
  • The Archicad plan file: This method links data to the database itself so it will act like any other BIM data (e.g. it will be uploaded to BIM server).
  • Associated to BIM elements: The data will act as a core data of BIM elements (e.g. the element should be reserved to modify this data).
  • Stored in library parts: The data will be stored in a special tagged section of the library part, and “travel” with it.

When storing the state of the user interface, storing data in preferences is usually the best choice. It won’t affect the database, or any other users in a teamwork project.


So it's up to you which method do you choose. You can store the data in the project/database (that way the data will transfer to the BIMcloud and all the users will get it) or you can store that in the actual user's computer etc...

Ok, thanks, I'll try that.

Hi Tibor,

I was able to save data of individual variables. Is there a way to save std::map or std::pair (or any other pairing or nesting datatype) in the local preferences file?

 

Thanks.

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!