Represents a workset in the document.
Inheritance Hierarchy
System.ObjectAutodesk.Revit.DB.WorksetPreview
Autodesk.Revit.DB.Workset
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.3.0.0 (25.3.0.0)
Syntax
C#
public class Workset : WorksetPreview
The Workset type exposes the following members.
Properties
Name | Description | |
---|---|---|
![]() | Id |
Id of the workset.
(Inherited from WorksetPreview) |
![]() | IsDefaultWorkset |
Whether the workset is the default one.
(Inherited from WorksetPreview) |
![]() | IsEditable | Whether the workset is editable. |
![]() | IsOpen | Whether the workset is open (rather than closed). |
![]() | IsValidObject |
Specifies whether the .NET object represents a valid Revit entity.
(Inherited from WorksetPreview) |
![]() | IsVisibleByDefault | Whether the workset is visible by default. |
![]() | Kind | Kind of the workset. |
![]() | Name |
Name of the workset.
(Inherited from WorksetPreview) |
![]() | Owner |
User name of the workset.
(Inherited from WorksetPreview) |
![]() | UniqueId |
UniqueId of the workset.
(Inherited from WorksetPreview) |
Methods
Name | Description | |
---|---|---|
![]() ![]() ![]() | Create | Creates a new workset. |
![]() | Dispose | (Inherited from WorksetPreview) |
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object) |
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.Example
C#
public void GetWorksetsInfo(Document doc) { String message = String.Empty; // Enumerating worksets in a document and getting basic information for each FilteredWorksetCollector collector = new FilteredWorksetCollector(doc); // find all user worksets collector.OfKind(WorksetKind.UserWorkset); // get information for each workset int count = 3; // show info for 3 worksets only foreach (Workset workset in collector) { message += "Workset : " + workset.Name; message += "\nUnique Id : " + workset.UniqueId; message += "\nOwner : " + workset.Owner; message += "\nKind : " + workset.Kind; message += "\nIs default : " + workset.IsDefaultWorkset; message += "\nIs editable : " + workset.IsEditable; message += "\nIs open : " + workset.IsOpen; message += "\nIs visible by default : " + workset.IsVisibleByDefault; TaskDialog.Show("GetWorksetsInfo", message); if (0 == --count) break; } }
VB
Public Sub GetWorksetsInfo(doc As Document) Dim message As [String] = [String].Empty ' Enumerating worksets in a document and getting basic information for each Dim collector As New FilteredWorksetCollector(doc) ' find all user worksets collector.OfKind(WorksetKind.UserWorkset) ' get information for each workset Dim count As Integer = 3 ' show info for 3 worksets only For Each workset As Workset In collector message += "Workset : " + workset.Name message += vbLf & "Unique Id : " & workset.UniqueId.ToString() message += vbLf & "Owner : " + workset.Owner message += vbLf & "Kind : " + workset.Kind message += vbLf & "Is default : " + workset.IsDefaultWorkset message += vbLf & "Is editable : " + workset.IsEditable message += vbLf & "Is open : " + workset.IsOpen message += vbLf & "Is visible by default : " + workset.IsVisibleByDefault TaskDialog.Show("GetWorksetsInfo", message) If 0 = System.Threading.Interlocked.Decrement(count) Then Exit For End If Next End Sub