ViewSheetSetAdditionalRevisionIds Method

Sets the Revisions to additionally include in the sheet's revision schedules.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public void SetAdditionalRevisionIds(
	ICollection<ElementId> projectRevisionIds
)

Parameters

projectRevisionIds  ICollectionElementId
The ids of Revisions to explicitly include in the sheet's revision schedules.
Exceptions
ExceptionCondition
ArgumentException One or more ElementIds in projectRevisionIds do not correspond to a Revision element.
ArgumentNullException A non-optional argument was null
Remarks
Additionally included Revisions will always participate in the sheet's revision schedules. Normally a Revision is scheduled in the revision schedule because one of its associated RevisionClouds is present on the sheet.

The additional project revision ids setting corresponds to the sheet's Revisions On Sheet parameter.

Example
public static void AddAdditionalRevisionsToSheet(ViewSheet viewSheet, String toMatch)
{
    Document doc = viewSheet.Document;

    ICollection<ElementId> revisions = viewSheet.GetAdditionalRevisionIds();

    // Find revisions whose description matches input string
    FilteredElementCollector collector = new FilteredElementCollector(doc);
    collector.OfCategory(BuiltInCategory.OST_Revisions);
    collector.WhereElementIsNotElementType();
    if (revisions.Count > 0)
        collector.Excluding(revisions);

    // Check if revision should be added
    foreach (Element revision in collector)
    {
        Parameter descriptionParam = revision.get_Parameter(BuiltInParameter.PROJECT_REVISION_REVISION_DESCRIPTION);
        String description = descriptionParam.AsString();
        if (description.Contains(toMatch))
            revisions.Add(revision.Id);
    }

    if (revisions.Count > 0)
    {
        // Apply the new list of revisions
        using (Transaction t = new Transaction(doc, "Add revisions to sheet"))
        {
            t.Start();
            viewSheet.SetAdditionalRevisionIds(revisions);
            t.Commit();
        }
    }
}
See Also