Get creator of a workset

I’m trying to get the creator of view worksets (so I can find out who made the views).

I tweaked Grimshaw’s Get Viewsets node to get view worksets. And I can get it find the Owner, but not creator.
The tweaked python code is:

viewWorksets = FilteredWorksetCollector(doc).OfKind(WorksetKind.ViewWorkset)
#extract workset’s name and ids
names, ids, owner, createdBy = [], [], [], []
for i in viewWorksets:
names.append(i.Name)
ids.append(i.Id)
owner.append(i.Owner)
createdBy.append(i.Creator)

createdBy not only returns nothing but kills the whole script, all variable are null.

 

It seems the Revit api can do it because I found an example that wrote the values to a dialog:

// Getting WorksharingTooltipInfo of a given element Id
WorksharingTooltipInfo tooltipInfo = WorksharingUtils.GetWorksharingTooltipInfo(doc, elemId);
message += ("\nCreator : " + tooltipInfo.Creator);
message += ("\nCurrent Owner : " + tooltipInfo.Owner);
message += ("\nLast Changed by : " + tooltipInfo.LastChangedBy);

 

Is it because Owner is not a property of FilteredWorksetCollector? Seems strange that Owner is but Creator is not.

Hi Anthony,

Unfortunately worksets do not have a “Creator” property. In the example you posted above, they’re extracting the the creator property from the “WorksharingTooltipInfo” member. (which I believe provides information about the individual model elements of a workset)

2015-09-29_14-23-56

 

2015-09-29_14-24-43

You can download the Revit SDK for more info: http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=2484975

Of course, the creator is a property of an element not a workset - duh.

I tweaked another node for get the workset of an element. It looks to me like it should work, but doesn’t:

 

import clr
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument
faminsts = UnwrapElement(IN[0])
elementlist = list()
creatorlist = list()
for item in faminsts:
try:
elementlist.append(doc.GetWorksetTable().GetWorkset(item.WorksetId))
creatorlist.append(doc.WorksharingUtils.GetWorksharingTooltipInfo(item.Creator))
except:
elementlist.append(list())
creatorlist.append(list())
OUT = elementlist, creatorlist

Try the following:

2015-09-29_17-22-23

Brilliant! Worked a treat.

Copy of custom node below if anyone is interested.

Element.Creator

1 Like