Open selected Worksets

Hi, is there any way to open Worksets when Revit model has been already opened?

The revitapidocs says about WorksetConfiguration:

the methods of this class just adjust the specification, and do not themselves open or close worksets.

But is there any way how to apply this specification to the project/model to actually open the Worksets?
This is my attempt - doesn’t work for me of course :slight_smile:

from Autodesk.Revit import DB

doc = __revit__.ActiveUIDocument.Document

if doc.IsWorkshared:
    ws_collector = DB.FilteredWorksetCollector(doc)\
    ws_ids = []
    for ws in ws_collector:
        if "link" not in ws.Name.lower():

    t = DB.Transaction(doc, "Open Non Link Worksets")

    ws = DB.WorksetConfiguration()


Hi @davidvadkerti
that should help
and especially this
all by the same person: Gui Talarico

Change Workset Settings
Set workset to be hidden by default in all views


Author: Gui Talarico |

This file is shared on
For more information visit

import clr

from Autodesk.Revit.DB import Transaction, WorksetKind, FilteredWorksetCollector
from Autodesk.Revit.DB import WorksetDefaultVisibilitySettings

doc = __revit__.ActiveUIDocument.Document

# collect all worksets
worksets = FilteredWorksetCollector(doc).OfKind(WorksetKind.UserWorkset)

# iterate over  worksets
for workset in worksets:
    # Find workset you want to target by name
    if workset.Name == 'Replace this with Name of Workset to Target':
        t = Transaction(doc)
        t.Start('Hide Workset in all Views')

        defaultVisibility = WorksetDefaultVisibilitySettings.GetWorksetDefaultVisibilitySettings(doc)
        defaultVisibility.SetWorksetVisibility(workset.Id, False)


and this too

Thanks @Jean-Marc, Yesterday I found both approaches though from a different source. If I am not missing something they do not do what I want to achieve.

  • 1st example is changing Default Workset Visibility - I don’t want to do this, this time :slight_smile:
  • 2nd example is doing what I want to achieve but with Worksets of Linked RVT models. As I get it Workset Opened/Closed status is written by LoadFrom(). I would like to do this not with links but the main host model.

My goal is to open Worksets (magenta column) not to Change its Default visibility (Azure column - this is what your second example does)

I want to open the model with all Worksets closed and then open just the Worksets without “link” in their name to improve performance in Revit Batch Processor Script. Everything works, Worksets are filtered out correctly but their Opened/Closed status is not changed at all.

Thanks :slight_smile:

1 Like

Check the last point :smiley:
Open closed worksets in open document? - Autodesk Community


This is awesome! Thanks!
This is my solution for now.

from Autodesk.Revit import DB
from Autodesk.Revit.DB.Document import GetElement

doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument

if doc.IsWorkshared:
    ws_collector = DB.FilteredWorksetCollector(doc)\

    for ws in ws_collector:
        if "link" not in ws.Name.lower():
            # get all elements in a workset
            filter = DB.ElementWorksetFilter(ws.Id)
            ws_elems = DB.FilteredElementCollector(doc)\
            if ws_elems:
                # get first element in a workset
                first_elem_id = ws_elems[0].Id