Workset Class


Represents a workset in the document.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since: 2012

Syntax

C#
public class Workset : WorksetPreview
Visual Basic
Public Class Workset _
	Inherits WorksetPreview
Visual C++
public ref class Workset : public WorksetPreview

Remarks

Worksets are a way to divide a set of elements in the Revit document into subsets for worksharing. There may be one or many worksets in a document. Each element in the document must belong to one and only one workset.

Examples

Copy C#
public Workset GetActiveWorkset(Document doc)
{
    // Get the workset table from the document
    WorksetTable worksetTable = doc.GetWorksetTable();
    // Get the Id of the active workset
    WorksetId activeId = worksetTable.GetActiveWorksetId();
    // Find the workset with that Id 
    Workset workset = worksetTable.GetWorkset(activeId);
    return workset;
}
Copy VB.NET
Public Function GetActiveWorkset(doc As Document) As Workset
    ' Get the workset table from the document
    Dim worksetTable As WorksetTable = doc.GetWorksetTable()
    ' Get the Id of the active workset
    Dim activeId As WorksetId = worksetTable.GetActiveWorksetId()
    ' Find the workset with that Id 
    Dim workset As Workset = worksetTable.GetWorkset(activeId)
    Return workset
End Function

Inheritance Hierarchy

See Also

ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →