can i get all elements of these worksets starting with a FilteredWorksetCollector ?
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
# 🌈 all Worksets
collector = FilteredWorksetCollector(doc).OfKind(WorksetKind.UserWorkset)
names = [i.Name for i in collector]
ids = [i.Id for i in collector]
OUT = []
for i,d in zip(names,ids):
OUT.append("{} - {} ".format(i,d))
collector = FilteredWorksetCollector(doc).OfKind(WorksetKind.UserWorkset)
names = [i.Name for i in collector]
worksets = collector
OUT = []
for workset in worksets:
elementWorksetFilter = ElementWorksetFilter(workset.Id)
fecbyWksetId = FilteredElementCollector(doc).WherePasses(elementWorksetFilter).ToElementIds()
#selectElemId = uidoc.Selection.GetElementIds(fecbyWksetId)
OUT.append(fecbyWksetId)
I’m expected, I’ll leave you, have a good quest and evening in the elimination of empty , for my part I’ve been trying to understand the events for several days (it’s very hard for my little head)
cordially
Christian.stan