We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2021-10-12 10:19 AM
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.
2021-10-12 04:06 PM - edited 2021-10-12 04:07 PM
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...
2021-10-14 09:07 AM
Ok, thanks, I'll try that.
2022-05-20 05:17 PM
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.