Extracts a collection containing the ids of elements that have been created, modified or deleted between the input baseVersion and the document's current version.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since:
2023
Syntax
Visual Basic |
---|
Public Function GetChangedElements ( _
baseVersionGUID As Guid _
) As DocumentDifference |
Parameters
- baseVersionGUID
- Type: System..::..Guid
GUID of base version(excluded) to compare. This GUID should be retrieved from property [!:Autodesk::Revit::DB::DocumentVersion::VersoinGUID].
Empty GUID is allowed to retrieve changes of each version in the document.
Return Value
An object containing collections of the created, modified and deleted ids between the input version and current version.
Examples
CopyC#
private void ShowChangedElements(Autodesk.Revit.DB.Document document, Guid baseVerseionGuid)
{
DocumentDifference docDiff = document.GetChangedElements(baseVerseionGuid);
if (docDiff.AreDeletedElementIdsAvailable)
{
TaskDialog.Show("Revit", "Deleted element history is available in current document.");
}
else
{
TaskDialog.Show("Revit", "Deleted element history is not available in current document.");
}
var createdElementIds = docDiff.GetCreatedElementIds();
var modifiedElementIds = docDiff.GetModifiedElementIds();
var deletedElementIds = docDiff.GetDeletedElementIds();
var changesetMessage = $"Found {createdElementIds.Count} new created elements, {modifiedElementIds.Count} modified elements and {deletedElementIds.Count} deleted elements.";
TaskDialog.Show("Revit", changesetMessage);
}
CopyVB.NET
Private Sub ShowChangedElements(ByVal document As Document, ByVal baseVerseionGuid As Guid)
Dim docDiff = document.GetChangedElements(baseVerseionGuid)
If docDiff.AreDeletedElementIdsAvailable Then
TaskDialog.Show("Revit", "Deleted element history is available in current document.")
Else
TaskDialog.Show("Revit", "Deleted element history is not available in current document.")
End If
Dim createdElementIds = docDiff.GetCreatedElementIds()
Dim modifiedElementIds = docDiff.GetModifiedElementIds()
Dim deletedElementIds = docDiff.GetDeletedElementIds()
Dim changesetMessage = $"Found {createdElementIds.Count} new created elements, {modifiedElementIds.Count} modified elements and {deletedElementIds.Count} deleted elements."
TaskDialog.Show("Revit", changesetMessage)
End Sub
Exceptions
See Also