Namespace:
Autodesk.Revit.Exceptions
CheckoutElementsRequestTooLargeException
Class
Description:
Exception is thrown when too many elements are requested for checkout
Exception is thrown when too many elements are requested for checkout
Inheritance Hierarchy:
System.Object
System.Exception
Autodesk.Revit.Exceptions.ApplicationException
Autodesk.Revit.Exceptions.CentralModelException
Autodesk.Revit.Exceptions.CheckoutElementsRequestTooLargeException
System.Object
System.Exception
Autodesk.Revit.Exceptions.ApplicationException
Autodesk.Revit.Exceptions.CentralModelException
Autodesk.Revit.Exceptions.CheckoutElementsRequestTooLargeException
Syntax
[SerializableAttribute]
public class CheckoutElementsRequestTooLargeException : CentralModelException
Examples
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.");
}
}