Get Workset value for 'Revision Settings'

Hi all,

Trying to get the workset value for the Revision Settings Dialogue box within Revit.

Does anyone know where this value could be found? Cant seem to access the Revision settings as an element within Dynamo.

I am trying to get them as an element via API using Python and the following code simply returned a builtin_function_or_method.

revision_settings = FilteredElementCollector(doc).OfClass(RevisionSettings).ToElements

My intention would then to be to feed the Revision settings as an element into the Archi-lab node Element.GetWorksharingTooltipInfo.

Any help would be appreciated! (API page for Revision settings below)

https://www.revitapidocs.com/2021.1/599f75fc-d2b6-63b3-7295-0c314415b638.htm

Seems to work if you just don’t use the archilab worksets - for some reason they have less properties available to inspect such as Owner.

worksetowner.dyn (10.8 KB)

1 Like

The Owner property won’t return Borrower though, as the OP is after :wink:

Don’t know if borrower is exposed. I couldn’t find anything atleast when I went through the various Workset related classes last night.

2 Likes

Yes you’re right. I tried finding a reference to borrower and no luck either. Onto the wish list forums it goes I guess…

2 Likes

I am not positive, but I think there may be two different things going on here. You can be a borrower of an Element IN the workset, which can be seen through ToolTip info on the Element, but if you OWN a workset in it’s entirety there are no borrowers.

https://www.revitapidocs.com/2015/ae7857a0-4e9b-f9c1-84c7-8b250af68068.htm

3 Likes

Yea makes sense - In this case, I couldn’t add a revision to a sheet because someone had the dialogue borrowed. I assume it would be the same principle for the manage links dialogue too.

As it’s not possible to return borrowers and I don’t think it’s likely that someone will ever own the revision settings element (curious how you forced this to be the case though @GavinCrump ?) I will just have to live with the error it will throw.

Thanks all for your time and input.

1 Like

Ah I misinterpreted the intent so got the owner property of the workset vs borrower. This is usually a property of any workset kind, but it looks like archilab converts their workset objects to a custom archilab class instead.

Here a workaround
there may be some optimization to be done by adding a filter in the collector

import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

#import net library
from System.Collections.Generic import List, Dictionary

#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument
app = uiapp.Application

currentUser = app.Username 

elems = DB.FilteredElementCollector(doc).WhereElementIsNotElementType()
out = {}
for e in elems:
	wksetstr = e.get_Parameter(BuiltInParameter.ELEM_PARTITION_PARAM).AsValueString()
	# get worksharing info
	wsu = WorksharingUtils.GetWorksharingTooltipInfo(doc,e.Id)
	# get current owner if different
	if wsu.Owner != "" and wsu.Owner != currentUser:
		out[wksetstr] = wsu.Owner
	
dictBorrower = Dictionary[str, str](out)	
OUT = dictBorrower
6 Likes