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: 

Revit/Dynamo temporary information storage

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
866 Views, 3 Replies

Revit/Dynamo temporary information storage

Does Revit or Dynamo have an internal dictionary or something that can be accessed to store information temporarily? I'm thinking of something similar to Rhino with scriptcontext.sticky which is a builtin that allows me to save user inputs and command settings for the duration of the document open session. 

 

Dynamo player does this automatically with inputs, but if I want to obtain user information from a form, I don't know of a way to store that info for subsequent usage of that script. 

 

If there isn't a built-in solution, I'm fine with pickling or exporting info to a text file instead. In this case, does anyone know of a good place to store this file so that it will exist while revit is open but deleted when the project or revit is closed? I suppose a user temp folder is fine too, as the text file will never be very big.

 

Thanks in advance for any input!

Tags (3)
3 REPLIES 3
Message 2 of 4
RPTHOMAS108
in reply to: Anonymous

Why not just use a static variable (shared in VB) to store the settings serialised string or otherwise? Depends on the number of settings and their content I suppose?

 

If using files I would probably put them in

1) C:\temp or

2) C:\Users\<User>\AppData\Local\Temp

 

You would have to remove them during OnShutdown of IExternalApplication. 

2) is the location referred to below:

https://docs.microsoft.com/en-us/dotnet/api/system.io.path.gettemppath?view=netframework-4.8&tabs=wi... 

 

 

Message 3 of 4
Anonymous
in reply to: RPTHOMAS108

Thank you for your suggestions.

 

I should have mentioned that I am working in python within Dynamo, which means (at least as far as i understand) that there isn't any variable that i can assign a value to that will be remembered when the script is run again. This also means I can't create an "onshutdown" type of scenario.

 

I will look at saving to temp folders. I am not to worried about not deleting them, as i can structure the script to overwrite if it exists. and the file is going to be almost nothing in size. Still, it would be ideal to have it deleted upon shutdown.

 

I think I'll take this over to the Dynamo forum and see if there are any thoughts there as this might be more of a dynamo issue.

Message 4 of 4
jeremytammik
in reply to: Anonymous

Yes, sounds like a Dynamo issue to me.

  

You could of course store stuff in the Revit model as well, e.g., using your own personal DataStorage element and adding extensible storage data to that. However, that would persist in the BIM.

  



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

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

Post to forums  

Forma Design Contest


Rail Community