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.
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Import RevitAPI
# Import Revit Nodes ¿?
# 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)
creator = 
lastChange = 
for i in input:
creator.Add( WorksharingUtils.GetWorksharingTooltipInfo(doc, i.Id).Creator)
#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!