Creates a new workset.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Since:
2015 Subscription Update
Syntax
Visual Basic |
---|
Public Shared Function Create ( _
document As Document, _
name As String _
) As Workset |
Visual C++ |
---|
public:
static Workset^ Create(
Document^ document,
String^ name
) |
Return Value
Returns the newly created workset.
Examples
CopyC#
public Workset CreateWorkset(Document document)
{
Workset newWorkset = null;
if (document.IsWorkshared)
{
string worksetName = "New Workset";
if (WorksetTable.IsWorksetNameUnique(document, worksetName))
{
using (Transaction worksetTransaction = new Transaction(document, "Set preview view id"))
{
worksetTransaction.Start();
newWorkset = Workset.Create(document, worksetName);
worksetTransaction.Commit();
}
}
}
return newWorkset;
}
CopyVB.NET
Public Function CreateWorkset(document As Document) As Workset
Dim newWorkset As Workset = Nothing
If document.IsWorkshared Then
Dim worksetName As String = "New Workset"
If WorksetTable.IsWorksetNameUnique(document, worksetName) Then
Using worksetTransaction As New Transaction(document, "Set preview view id")
worksetTransaction.Start()
newWorkset = Workset.Create(document, worksetName)
worksetTransaction.Commit()
End Using
End If
End If
Return newWorkset
End Function
Exceptions
See Also