I’m trying to get a list of the Workset names that the links resides in from the model. so i wonder if there is a node in dynamo that can pull the name of the workset
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
#🌈 links
linked_docs = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_RvtLinks).WhereElementIsNotElementType().ToElements()
lnkInstance = [i for i in linked_docs if i.Name.Contains("ARCH")]
doclnk = lnkInstance[0]
# 🎹 get workset
worksetId = doclnk.WorksetId.IntegerValue
OUT = worksetId
1 Like
It’s just a parameter and an element/Id. You should be able to get the value with GetParameterValueByName
. There’s a weird bug in some versions where workset sometimes returns the element and sometimes returns the Id, but you can deal with either. You can get the element from the Id if you need to and then get the name directly from the element.
With a little python (or the right custom node), you can also get it directly via the parameter with AsValueString()
.
1 Like
Both works thanks guys
1 Like