Get the file name of the active revit document


#1

Hi,

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.


#2

Hi Mark,

Here is one of the possible way using Python.


#3

@Mark_246

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 :


#4

Nodes available OOTB …


#5

Thanks for the assistance, all sorted now!


#6

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


#7

Hi,

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


#8

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
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
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 :


#9

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


#10

Absolutely! :slight_smile:


#11

Absolutely wonderful! :grinning: