Hi all,
I am developing a workflow in order to monitor and track the scripts usage from all of the offices of the company where I am working for, here in Italy. I think it will be really useful to see how many times the scripts are used, from who and when.
In the next months you could create some dashboards to analyze those data, maybe combined with other data sets and do your “data analysis” and observations.
The code started from the @john_pierson one, then I’ll added a couple of things.
PS
We are currently using still Dynamo 1.3 and obviously I know it could be done in better ways, but I’ve just started coding like 10 days ago and this code it’s working for me at the moment. If there are improvements you think I could include, please feel free to tell me
Stop talking, here is the code:
# ---------------------------------------------------------------------- CREDITS
"""
GET FILE, USER AND DATE INFORMATIONS
"""
__author__ = "Ernesto Pellegrino - pellegrinoernesto@gmail.com"
__twitter__ = "@aitenlabs"
__linkedin__ = "linkedin.com/in/pellegrinoernesto/"
__version__ = '1.0.0'
"""
This code started from the John Pierson (twitter @60secondrevit) one in order to obtain the dynamo workspace name.
I've added the username, the date and the time informations.
Please note that the date and time outputs might vary based on your own PC settings.
"""
# ---------------------------------------------------------------------- IMPORTS & REFERENCES
import clr
clr.AddReference('DynamoRevitDS')
import Dynamo
clr.AddReference('DSCoreNodes')
import DSCore
from DSCore import *
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
# ---------------------------------------------------------------------- DATA
# access to the current Dynamo instance and workspace
dynamoRevit = Dynamo.Applications.DynamoRevit()
currentWorkspace = dynamoRevit.RevitDynamoModel.CurrentWorkspace
dynamoFileName = currentWorkspace.FileName
# get the user
app = DocumentManager.Instance.CurrentUIApplication.Application
userName = app.Username
# get the current date and time
Now = DSCore.DateTime.Now
Day = DSCore.DateTime.DayOfWeek(Now)
Date = Now.ToString()[:10]
Time = Now.ToString()[11:16]
# ---------------------------------------------------------------------- OUTPUT
# output the username, the Dynamo Workspace name, the date & time
OUT = userName, dynamoFileName, Day, Date, Time
This is the custom node you can use
aitenlabs.GetUserAndWorkspaceInformations.dyf (11.8 KB)