Dynamo: Get the Creator and Last Editor of a Revit Element

This week we were asked to find a way to report how many elements a specific user had created. For this we code a small python script that uses the Revit API tool
WorksharingUtils.GetWorksharingTooltipInfo(Document, ElementID) to return the creator and the name of last user who edited it. (Thanks to JF for the idea)

Here is the code to do it.

import clr
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

# Import RevitAPI
clr.AddReference('RevitAPI')
import Autodesk
# Import Revit Nodes ¿?
clr.AddReference("RevitNodes")
import Revit
# Import from Revit DB
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

input = UnwrapElement(IN[0])
creator = []
lastChange = []
for i in input:
	creator.Add( WorksharingUtils.GetWorksharingTooltipInfo(doc, i.Id).Creator)
	lastChange.Add(WorksharingUtils.GetWorksharingTooltipInfo(doc, i.Id).LastChangedBy)
	


#Assign your output to the OUT variable.
OUT = creator, lastChange

As result we will get two lists. One with the creator’s name and a second one one with the name of the last editor.

If we use this information to fill a text parameter we could use it to create schedules or even export a Navisworks model to use with the report add-in to fill a data base.

Hope you find this code useful!

5 thoughts on “Dynamo: Get the Creator and Last Editor of a Revit Element”

  1. Hello,

    Thank you very much for this.
    Was trying to run it but got this Warning.
    Any ideas on what I need to do to fix it?

    Thank you

    Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
    Traceback (most recent call last):
    File “”, line 22, in
    TypeError: iteration over non-sequence of type FootPrintRoof

    1. Joaquim, glad you find it useful!
      From what you are showing me I can infer the error appears when you are trying to extract the owner of a roof path chain of lines.
      Some elements doesn’t have workset information and that could lead to this error.
      Could you share how you are selecting the elements in the model?

    2. I think the Foot print roof is a “property” of an objects, it has no workset.
      Just like any viewport, annotations, etc…

      This tool works only with elements that have a workset..
      Check on Revit help which ones are!

    1. Hi John! I believe there is no way to access that information from the API, but if you have access to the user’s journals you may find the information you are looking for.

Leave a Reply

Your email address will not be published. Required fields are marked *