Get the file name of the active revit document



I’m wondering if it is it possible to get the file name of the active Revit document automatically using dynamo without having to manually browse for it.

I currently use the FilePath.FileName node, connected to the file path browse node; but this method requires the user to manually browse for the file when opening different projects.

Thanks for any help in advance.


Hi Mark,

Here is one of the possible way using Python.



there is a node in node mode usineg the same API method as the one mentionned in kulkul’s reply, it gives the document name and the file path :


Nodes available OOTB …


Thanks for the assistance, all sorted now!


2 posts were split to a new topic: Extract name from File Path



I would find the node you show, where can I find it ?


hi @c.barribaud ,
I’m not maintaining node-mode anymore and I didn’t move this node to Data-Shapes. Here’s the code though if wou want it :

import clr
from Autodesk.Revit.DB import*
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument
path = doc.PathName
docname = path.encode('string-escape')

OUT = docname.split('\\\')[-1] , path

you can also do it with ootb nodes :


May I ask something: will you maintain the Data-Shapes package in the future? :slight_smile:


Absolutely! :slight_smile:


Absolutely wonderful! :grinning: