Exception is thrown when too many elements are requested for checkout
Namespace: Autodesk.Revit.Exceptions
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since: 2021
Syntax
C# |
---|
[SerializableAttribute] public class CheckoutElementsRequestTooLargeException : CentralModelException |
Visual Basic |
---|
<SerializableAttribute> _ Public Class CheckoutElementsRequestTooLargeException _ Inherits CentralModelException |
Visual C++ |
---|
[SerializableAttribute] public ref class CheckoutElementsRequestTooLargeException : public CentralModelException |
Examples
![](/static/chm/revit/icons/CopyCode.gif)
void HandleCheckoutElementsRequestTooLargeException(Document doc) { FilteredElementCollector collector = new FilteredElementCollector(doc); ICollection<ElementId> rooms = collector.WherePasses(new RoomFilter()).ToElementIds(); try { ICollection<ElementId> checkoutelements = WorksharingUtils.CheckoutElements(doc, rooms); } catch (Autodesk.Revit.Exceptions.CheckoutElementsRequestTooLargeException) { IEnumerable<WorksetId> worksets = rooms.Select(elemId => doc.GetWorksetId(elemId)).Distinct(); TaskDialog dlg = new TaskDialog("Elements can't be checked out") { MainInstruction = $"You are trying to check out a large number of elements. Instead check out the following {worksets.Count()} worksets:", MainContent = string.Join(", ", worksets), }; dlg.Show(); TransactWithCentralOptions twcOptions = new TransactWithCentralOptions(); ISet<WorksetId> worksetsCheckedout = WorksharingUtils.CheckoutWorksets(doc, worksets.ToHashSet(), twcOptions); TaskDialog.Show( title: "Worksets are checked out", mainInstruction: $"{worksetsCheckedout.Count} worksets are checked out."); } }
![](/static/chm/revit/icons/CopyCode.gif)
Private Sub HandleCheckoutElementsRequestTooLargeException(ByVal doc As Document) Dim collector As FilteredElementCollector = New FilteredElementCollector(doc) Dim rooms As ICollection(Of ElementId) = collector.WherePasses(New RoomFilter()).ToElementIds() Try Dim checkoutelements As ICollection(Of ElementId) = WorksharingUtils.CheckoutElements(doc, rooms) Catch __unusedCheckoutElementsRequestTooLargeException1__ As Autodesk.Revit.Exceptions.CheckoutElementsRequestTooLargeException Dim worksets As IEnumerable(Of WorksetId) = rooms.[Select](Function(elemId) doc.GetWorksetId(elemId)).Distinct() Dim dlg As TaskDialog = New TaskDialog("Elements can't be checked out") With { .MainInstruction = $"You are trying to check out a large number of elements. Instead check out the following {worksets.Count()} worksets:", .MainContent = String.Join(", ", worksets) } dlg.Show() Dim twcOptions As TransactWithCentralOptions = New TransactWithCentralOptions() Dim worksetsCheckedout As ISet(Of WorksetId) = WorksharingUtils.CheckoutWorksets(doc, worksets.ToHashSet(), twcOptions) TaskDialog.Show(title:="Worksets are checked out", mainInstruction:=$"{worksetsCheckedout.Count} worksets are checked out.") End Try End Sub
Inheritance Hierarchy
System..::..Object
System..::..Exception
Autodesk.Revit.Exceptions..::..ApplicationException
Autodesk.Revit.Exceptions..::..CentralModelException
Autodesk.Revit.Exceptions..::..CheckoutElementsRequestTooLargeException
System..::..Exception
Autodesk.Revit.Exceptions..::..ApplicationException
Autodesk.Revit.Exceptions..::..CentralModelException
Autodesk.Revit.Exceptions..::..CheckoutElementsRequestTooLargeException