Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to store plugin Preferences

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
dimi_christop
1127 Views, 4 Replies

How to store plugin Preferences

Hi

I am trying to find a way to store user preferences for my plugin.

These preferences are file paths, import options etc. so that the next time the user runs the plugin

all the choices he made the fist time he used the plugin stay the same.

Is there an API functionality which helps in this? Are there any guidlines how to do that? any user experience in the Forum about this issue.

 

Thanks in advance

Dimi

4 REPLIES 4
Message 2 of 5
peterjegan
in reply to: dimi_christop

If you are using Visual Studio C#, there is feature made exactly for this. Have a look at "Using settings in C#" here: http://msdn.microsoft.com/en-us/library/aa730869(v=vs.80).aspx This is what I do. Some people who want more control will develop their own system, but I suggest starting here. It is really easy and effective.
Message 3 of 5
ollikat
in reply to: peterjegan

Hi

Another approach could be so called Extensible Storage mechanism in Revit API. That would allow you to save project specific settings. I mean a scenario where user wants to have different settings in different project. You can read more about it from BuildingCoder block

http://thebuildingcoder.typepad.com/blog/2011/04/extensible-storage.html

But if you are just trying to store information, that doesn't have direct relationship to Revit project, then it might be better to use mechanism that peterjegan suggested.

Message 4 of 5

Thanks for the nice links,

the setting are not project specific so I will give the using settings of @peterjegan a try.

 

Message 5 of 5
dimi_christop
in reply to: peterjegan

Hi

the C#  Visual Studio User Settings suggested by @peterjegan worked fine.

Neverheless in my case its was even easier sinc I wanted user setting for Windows Forms entries. There is a way to associate user settings with a Windows Form component inside the Form Designer. This means even less code for reading/writing.

http://msdn.microsoft.com/en-us/library/wabtadw6%28v=vs.110%29.aspx

 

The only CAVEAT I found is that you have to call save before closing the Form otherwise the settings get lost.

Properties.Settings.Default.Save();

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community