Default path for user files

Hello everyone.

How can get the path in Revit -> option -> File locations -> Default path for user files by Revit API?

image

Thank you very much.

I’m not sure if there is a standard way of doing this, but you could read the Revit.ini file to get this information

I tried searching “path” or “user” or “file” on Revit api docs but couldn’t find anything

Something like this? Do you want to edit it or just read it?

2 Likes

Many thank you.
At the moment, I only want to read it. But Could you give me a solution to read it on all computers. It depends on Revit install location.
I think the next question is: How to get the path of Revit.ini file by API or something like that.

Thank for you reply. Me too.

With Python:

import clr
from System import Environment

path = "C:\Users\{0}\AppData\Roaming\Autodesk\Revit\{1}\Revit.ini"
args = (Environment.UserName,IN[0])
OUT = path.format(*args)

The Python node would have one input for the application name which you can get with Clockwork’s Application.Version node.

2 Likes

Awesome, but sometime User folder not in C:.
So how to determine the location of User folder.
I do not have much experiences about the path in Window.
Thank you very much.

In that case, try what Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) gives you.

1 Like

Thank for all your help. I have solved it.