I think what I have to do is to get the current Dynamo graphs’ workspace but I don’t know how to do it. I could then get the filename with through Dynamo.Graph.Workspaces.WorkspaceModel
# access to the current Dynamo instance and workspace
dynamoRevit = Dynamo.Applications.DynamoRevit()
currentWorkspace = dynamoRevit.RevitDynamoModel.CurrentWorkspace
Thing is, as you mention, it will only work with Dynamo for Revit and I’m using Core
Could there be a similar (simple) solution for Core as well?
thanks for this amazing solution. I tried to use your code in a user-defined-node but it does not get the path. Is it possible to make it run inside a node?
I’m trying to create a node based off your code.
It works the first time I run it, but a second Run in the same Dynamo session returns nul.
Exact same code, not changing anything. All I’m doing is running it a second time
import clr
clr.AddReference('DynamoServices')
from Dynamo.Events import *
OUT = ExecutionEvents.ActiveSession.CurrentWorkspacePath