How to get Dynamo script's file name in Dynamo for Civil 3D

I want to do some loggings and I need the Dynamo script file name. I know there is some Python code for Revit. But I need it to work for Civil 3D.

Thanks.

I am actually working on the same thing right now haha. Here you go:

import clr

clr.AddReference('AcDynamo')
from Autodesk.AutoCAD.DynamoApp import *
# Gets Dynamo instance so the active script can be recorded

def GetGraphNameCivil3D():
	AcDynamoRuntime.Initialize()
	DynamoModel = AcDynamoRuntime.DynamoModel
	DynamoWorkspace = DynamoModel.CurrentWorkspace
	return DynamoWorkspace.FileName

#Define Output (OUT)
OUT = GetGraphNameCivil3D()
6 Likes

Hey Joël,

Thanks a lot!

I am curious how you figgered it out. :smirk:

We are using this Dynamo script name with other parameters for logging purposes.

Kind regards, Edward

Haha, a lot of peeking in the Civil dll’s and experience with the Dynamo API

4 Likes

Thanks for your effort @Joelmick