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: 23.0.0.0 (23.1.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);
}
Exceptions
See Also