Skip to content

Keep the inserted fields of an object when the next one is cut out - #356

Merged
mahach666 merged 3 commits into
mainfrom
fix/r22-trailing-defaults
Dec 4, 2026
Merged

mahach666 merged 3 commits into
mainfrom
fix/r22-trailing-defaults

Conversation

@mahach666

Copy link
Copy Markdown
Collaborator

What changes and why

The rewrite of a Revit 2023 or later file into the 2022 layout lost data. It inserts the fields the 2022 class adds
at the end of an object where the next object starts. When that next object has no Revit 2022 class,
R22Transcoder.Payload removed every edit from its start on before cutting it out, so those inserts were removed too
and everything after them moved by their length.

Reading a cut object adds no edits, so the removal could only reach inserts that belong to the object before it. The
line is removed.

How it was checked

  • New test Payload_KeepsTheFieldsAddedAtTheEndOfAnObjectBeforeOneItCuts: it fails on main and passes with the
    change.

  • dotnet build RvtIO.slnx -c Release succeeds. The warnings come from building the test project and its packages;
    the same warnings are on main, and this change adds none.

  • Tests in Release with RVTIO_TEST_FILES set: net10.0 12403 passed, 0 failed, 366 skipped; net8.0 12399 passed,
    0 failed, 366 skipped.

  • IFC, compact and full JSON, Scene and the report written by tools/benchmark-export.py on a local set of sample
    files are byte-identical to main. Why the restored bytes do not change any of these outputs has not been traced.

  • A temporary counter that is not part of this change shows that the removed line did drop non-empty inserts in real
    files, before cut objects of the classes GPoint, StructAttachInfo, RebarInstCache and
    AnalyticalSingleUpstreamNodeData, and that reading a cut object never added an edit. Where the damaged payload is
    a CoordinateSystemDisplayElem or a MEPAnalyticalDistributionNode, it reads exactly with the 2022 class table
    only with this change. For FamilyInstance and Rebar payloads that check stops before the restored bytes, at the
    same place with and without the change, so it says nothing about them.

  • dotnet build RvtIO.slnx -c Release has no warnings

  • dotnet test passes

  • Exports of the same files before and after are identical, or the differences are listed and intended

  • No Revit models, customer data or vendor files are added

The rewrite into the 2022 layout inserts the fields a 2022 class adds at the
end of an object where the next object starts. When that next object had no
2022 class, every edit from its start on was removed before cutting it out, so
those inserts were lost and the data after them moved. Reading a cut object
adds no edits, so the removal is not needed.
@mahach666
mahach666 merged commit 1dfc0c2 into main Dec 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant