CheckoutElementsRequestTooLargeException Class


Exception is thrown when too many elements are requested for checkout

Namespace: Autodesk.Revit.Exceptions
Assembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
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

Copy C#
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.");
   }
}

Inheritance Hierarchy

System Object
System Exception
Autodesk.Revit.Exceptions ApplicationException
Autodesk.Revit.Exceptions CentralModelException
Autodesk.Revit.Exceptions CheckoutElementsRequestTooLargeException

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 →