RvtRevisionDiffer (API) and rvtio diff (CLI) compare two Revit model revisions and report element additions, deletions, parameter edits, type changes (with linked affected instances), world-space placement shifts, geometry/layer/sketch modifications, relationship changes, and external transmission link changes.
- Persistent Identity (
UniqueId): Elements are matched primarily byElement.UniqueId(Revit creation-episode GUID + original creation element ID), which stays invariant across saves, renumbering, and Revit file version upgrades. - No Blind Numeric
ElementIdMatching: NumericElement.Id/ElementIdalone is never assumed to match elements across unrelated or ambiguous documents. Elements lacking aUniqueIdare surfaced underUnavailable(reason = "missing-persistent-identity") by default;RvtDiffOptions.AllowElementIdFallbackWhenRelated(--allow-id-fallback) optionally pairs them by unique(ElementId, CategoryId)only when both documents are verified asRelated. - Ambiguous Identity: If a
UniqueIdappears more than once in either revision, all instances carrying thatUniqueIdare placed inAmbiguousMatches(duplicate-unique-id) rather than guessed. - Relatedness Detection: Comparing two documents computes
RvtRevisionRelation:Related: shared persistentUniqueIds or matchingSerializedDocumentGuid.Unrelated: distinct document GUIDs and zero sharedUniqueIds, or disjoint non-emptyUniqueIdsets. A warning is emitted and numeric IDs are never paired.Indeterminate: neither side contains persistent document/element identity markers.
- Partial Decoding & Unavailable Data:
- When
ElemTableIsExact == falseorDiagnostics.LimitHits/ failed streams exist on a side, missing elements on the incomplete side are reported inUnavailable(partial-decode-prevents-deletion-confirmation/partial-decode-prevents-addition-confirmation) instead of confirmed removals or additions. - When one revision has
WideLayoutNotRewritten/GeometryUndecoded(R22Layout = falseon Revit 2023+ wide schema) and no geometry, missing geometry is markedRvtDiffAvailability.Unavailablerather than deleted. - When faces were left untriangulated or placed symbols were unresolved, geometry is marked
Partialeven if all decoded faces match. Availability alone does not imply a semantic change. - Incomplete parameter stores (
!NativeParameterStoresComplete) mark missing parameters as unavailable rather than deleted.
- When
- Internal Units: All numeric parameter values, transforms, location curves, and geometry coordinates are compared in Revit internal units (feet, square feet, cubic feet, radians) regardless of project display unit settings. By default (
IncludeDisplayFormattingDifferences = false), changes solely to display formatting (UnitSymbol,ConversionFactor,AsValueString) do not trigger false parameter changes. - Local vs. World Coordinates:
LocationCurve,InstanceTransform,Geometry.Transform, andElement.DecodedBoxare compared in document world coordinates (feet).- Pure rigid translation of a placed instance reports a
PlacementChange(TranslationFeet,TranslationDistanceFeet,RotationDeltaDegrees,MirroredChanged). Bounding boxes, face origins, and contours are compared after compensating for that translation. - Shared
FamilySymbolgeometry stays in family-local coordinates; modifying a symbol/type records aRvtDiffTypeImpactlinked to every affected placed instance (AffectedInstancesandAffectedByTypeIdentityKeys).
- Default Tolerances (
RvtDiffOptions):LinearToleranceFeet:1e-4ft (~0.03048mm)AngleToleranceRadians:1e-5rad (~0.00057deg)AreaToleranceSquareFeet:1e-4ft² (~9.3mm²)NumericParameterTolerance:1e-6
Face and trim-loop order, the start vertex of a contour, and contour winding do not affect the comparison. The geometry diff reports changes to decoded contours and to the position or size of openings in extruded solids. Tolerances must be finite and non-negative.
When comparing paths (RvtRevisionDiffer.Compare(leftPath, rightPath) or rvtio diff), both revisions default to R22Layout = true and ResolveCurrentCopies = true so geometry, parameters, and persistent UniqueIds decode consistently across 32-bit (up to Revit 2023) and 64-bit (Revit 2024+) schemas. Target element references (ELEM_TYPE_PARAM, LEVEL_PARAM, HostId, Cutters, Connectors) are resolved by target UniqueId so internal numeric ID remapping across upgrades produces zero false diffs.
rvtio diff rev1.rvt rev2.rvt
rvtio diff rev1.rvt rev2.rvt --json diff.json
rvtio diff rev1.rvt rev2.rvt --category OST_Walls --linear-tol 0.001 --redact--redact scrubs recognized personal identifiers and sensitive paths in the report and in read and write diagnostics.
var report = RvtRevisionDiffer.Compare("rev1.rvt", "rev2.rvt", new RvtDiffOptions
{
Categories = ["OST_Walls"],
LinearToleranceFeet = 1e-4,
});
File.WriteAllText("diff.json", report.ToJson());