Returns the active workset's WorksetId.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 26.1.0.0 (26.1.0.34)
Syntax
C#
public WorksetId GetActiveWorksetId()
Return Value
WorksetIdWorksetId of the active workset.
Example
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; }
VB
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