Get the Dynamo File Path or Name

Hello follow Dynamo Users,

I was wondering if there is a script (python) to get the current Dynamo FilePath or FileName?

When there is one, could you explain how it works and how to set it up?

I would like to make a Dynamo Log in the following Printscreen:

Currently i fill the filename manualy into a codeblock.

Thanks in advance.



I couldn’t find a method for this and ended up just including the definition name in each definition.

I’m a big fan of data logging to track implementation and using a consistent templates make for an extremely useful data log that can be mined to track all sorts of goodies.

There are methods for Revit Version, Revit Build, Revit File, Revit File location, Timestamp, and username.

Then you can parse the data via a custom definition to find out who’s using what/when/and on which projects, then map things like functional role, tenure, office location, etc!

You can even represent the data as a 3d dynamo graph!

Hello Jeff,

I allready made a log like the printscreen in my first post! In there I allready use the Revit username inside log. I will post some printscreens below. You gave me some point to maybe add in this log for the future.

What do you mean with a 3D Dynamo log?

About the Lauch.Resource node, where can i find this one? This could be a usefull node inside the company here.



By 3d Dynamo Log" I mean use the data inside of Dynamo to create 3D bar graphs, pie graphs, etc using Dynamo’s geometry tools. Just a neat way to review the data without using Excel. Another option if you want to review data realtime is to use a web-based approach, then no more parsing the log file to mine data.

There might be an official node somewhere but I just use a simple python script for this. Note the script was setup for webpages, but it opens webpages, file directories, and pretty much any other file type that windows knows which platform to use.


Dynamo - Log Chart

If you have a lot of users that workshare I would recommend including Revit Version, Revit Build Number, and project number.

This has proven very valuable in troublshooting incompatibilities with varying builds of the same version.

The project name can be mapped to all sorts of other internal data if you track it.

I’ve started using this logging in conjunction with project file histories to map usage and file access per project, projecttype, tenure, title etc to glean where the most value permitting better focus on specific groups and concepts.


Hi guys,

I really like where this topic is going. These are some great tips on management techniques! Jeff I just love that improv graph builder.

Unfortunately, from what I understand, it’s impossible to get the name of the active workspace from a python node because the node resides in an entirely separate scope. Tho we can try to be creative and instead probe the log files. Dynamo logs almost everything and you can find those logs in the following path:


The below script fetches the latest log and searches for the latest save event. A graph open event does not get logged for some weird reason but luckily a save event does. We can use that to our advantage. If the user saves the file immediately after execution ( possibly not a good idea if they’ve made any changes? ), the script will read the path from that event and report it.

The above is also a great demonstration on why you should never have spaces in your file paths :} A ZT node might be able to get access to the active workspace but I don’t plan on spending my weekend trying to find that out.



About the Revit version, how do i recieve this from the Revit API? would it be a problem for you to share your script it seems to be a good learning resource for me as a student.

And btw i use my log after i run different scripts so the digital graph inside Dynamo isn’t an option in my case i guess.

The custom node you made will send people to the next instruction video for my scripts.


I used your script and it works awesome accept the fact that you need to save as you said. Mabye a silly question… What is a ZT node and how does it work? i googled a bit but still didnt understand what they do.

Thnx for the advice guys.


ZT or “Zero Touch” is the way in which Dynamo automatically generates custom nodes from generic c# libraries. Each public class and method in that library will be converted to a node. You can find more about it here:

If at all possible, you’ll need to get the instance of the HomeWorkspaceModel object. From it, you can extract all kind of data about the current graph like file name, placed nodes and what have you.

1 Like

Okay when i got some more time in my research I will take a look at it. It seems to be pretty difficult!

Thnx for your help, I will keep your guys informed.