Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ API between minor releases.

### Added

- Add experimental native RVT downgrade output using a target-release profile. The CLI writes a separate file and can report known omissions. Writing projects for Revit 2020 or 2021 requires a complete target project with unit data.

- Report progress while reading a Revit file: `RvtReadProgress` (phase, completed and total units),
`RvtReaderOptions.Progress` and `RvtSceneOptions.ReadProgress` (for `RvtSceneReader.Read(path)`). The reader calls
`IProgress<RvtReadProgress>.Report` synchronously on the reading thread, in phase order; see
Expand Down
34 changes: 22 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,26 +189,36 @@ A file saved in several increments can hold an element in more than one partitio
| 2 | The input cannot be read: it is missing, empty, not a compound file, or cut or damaged. One line on standard error, no stack trace. |
| 3 | A stream exceeded a limit of the reader and the read was cut. Nothing is exported unless `--allow-partial` is given. |
| 4 | The file is readable but a decoder failed on its content. |
| 5 | `downgrade --check` refused the request, for example because the source is newer than release 2026, the profile is not older than the source, the saving release of a file does not match its class table, or a class name occurs twice in a table. One line on standard error. |
| 5 | `downgrade` refused the requested conversion, for example because the profile is not older than the source or the file does not match its class table. |
| 6 | `--strict` was given and the read was partial without hitting a limit (a member failed to decode, was rebuilt by structural recovery, or decoded without a matching checksum, or the element table decoded no row). Nothing is exported; the report lists the streams and the reason. |

`--report project.report.json` writes a machine-readable report: the fraction of each partition stream and of the element table that decoded, the streams cut by a limit, the elements the export left out with their class and reason, and the exported fraction. `--strict` makes partial reads that did not hit a limit fail with exit code 6 instead of exporting with exit code 0. `--raise-limits` raises the limits for a very large model. A complete export without these options behaves as before. The report format and the limits are described in [the export report](docs/export-report.md).

### Plan a downgrade to an older release (experimental)
### Downgrade a project to an older release (experimental)

```powershell
rvtio downgrade project2026.rvt --target-profile project2025.rvt --check --report downgrade.json
rvtio downgrade project2027.rvt --target-profile profile2026.rvt --check --report plan.json
rvtio downgrade project2027.rvt --target-profile profile2026.rvt --output project2026.rvt --allow-loss --report downgrade.json
```

`downgrade --check` compares the class table of a project (the stream `Formats/Latest`) with the class table of a project or family saved by an older release, the profile, and reports what editing the first table to fit the second would change. It writes nothing but the report. Nothing is embedded in RvtIO: the profile is read from the file you give. The report lists:

- the classes only the source defines, with the number of elements the file holds in each (counted from the partition streams); in an earlier trial with one 2026 sample project edited by hand and opened in Revit 2025, the 64 elements of such classes were not in the file that Revit 2025 then saved;
- the classes only the profile defines;
- the classes whose version is higher in the source (the version is lowered to the profile's);
- per class, the stored fields that exist in one table only, matched by name (the command only lists them; what an older release does with them was compared in that one trial only, where one element out of 13872 kept in both files differed in the values of a property);
- the classes whose list of upgrade identifiers changes, with the number added and removed. `--guid-rule exact` (the default) makes the list the profile's list of the same class; `--guid-rule minimal` only removes the identifiers the profile does not list. A list is empty after the edit only when the rule yields no identifier for that class.

Limits: the plan is computed from the bytes of the two files. This version cannot write a converted file, and no application opened a converted file as part of this change. The tested source release is 2026; a source of a newer release, a source whose saving release differs from the release of its class table, and a profile that is not older than the source are refused with exit code 5 and one line on standard error. A file that cannot be read, or whose partition stream is damaged, exits with code 2; a wrong command line, including an empty or unusable path, exits with code 1. Without `--check` the command refuses to run.
Use a profile saved by the target release. `--check` compares class versions,
stored fields, and upgrade identifiers and writes only the optional report.
When writing a project for Revit 2020 or 2021, use a complete `.rvt` saved by
that release. The writer uses project unit formats for 2020 and unit schema
catalogs for 2021. A profile containing only a class table is usable with
`--check`.
`--guid-rule exact` is the default. `--guid-rule minimal` keeps identifiers that
both tables declare. `--output` writes a separate RVT and leaves the original
and profile intact. For a chain across multiple releases, use the output of
each step as the input for the next one.

Older Revit releases cannot represent every newer record. A conversion with
known omitted record owners requires `--allow-loss` and a JSON `--report`.
The report lists affected record owners and known project and analytical omissions.
Review the report and open the output in the target Revit release before relying
on it. `--restore-legacy-analytics` applies only when writing Revit 2022 from a
Revit 2023 or later project. It requires an earlier Revit 2022 revision of the
same project as the profile and restores supported analytical records.

### Measure how much of a file is decoded

Expand Down
2 changes: 1 addition & 1 deletion docs/export-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Without the new options the output (IFC, JSON, standard error text) and the exit
| 2 | input error | The input cannot be read: the file does not exist or cannot be opened, is empty, is not a compound file, or is cut or damaged so that a stream ends before its declared length. One line on standard error, no stack trace, nothing exported. |
| 3 | limit exceeded | A stream exceeded a reader limit. For a recoverable limit, `--allow-partial` permits export. Hard limits (`array-length`, `element-id-range`) stop export with exit code 3 regardless of options. |
| 4 | decode error | The compound file is readable but a decoder failed on its content (damaged or unsupported data). One line on standard error; the report holds the exception with its stack trace. |
| 5 | refused | `downgrade --check` refused the request (for example a source newer than release 2026, a profile not older than the source, a saving release that does not match the class table, or an ambiguous class name). One line on standard error. |
| 5 | refused | `downgrade` refused the request (for example a profile not older than the source, a saving release that does not match the class table, or known omissions without `--allow-loss`). One line on standard error. |
| 6 | partial read | `--strict` was given and the read finished partial without exceeding a limit (members of a stream failed to decode, were rebuilt by structural recovery, or decoded without a matching checksum, or the element table decoded no row). One line on standard error naming the streams and the reason, nothing exported; the report holds the stream counts and `issues[]`. |

A standalone family without decoded triangle geometry cannot be exported to GLB. The CLI returns 4 and the report records `error.kind: "glb-family-geometry-unavailable"`.
Expand Down
2 changes: 1 addition & 1 deletion docs/public-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ projects through `InternalsVisibleTo`.
| `RvtReadDiagnostics`, `StreamRecord`, `ReaderLimitHit` | What a read collects when `RvtReaderOptions.Diagnostics` is set: the partition and metadata streams read (stored and inflated byte sizes and member decode counts) and the streams cut by a limit. |
| `RvtReadProgress` | File-reading updates delivered through `RvtReaderOptions.Progress`. |
| `ExportReport`, `SkipLog`, `GeometryQualityClass`, `ElementGeometryQuality` | The machine-readable report of a run (`ToJson`), the per-element geometry quality classification and totals, and the elements an export left out; see [the export report](export-report.md). |
| `RvtExitCodes`, `RvtInputException`, `RvtLimitException`, `RvtContainerCheck` | The exit codes 0 to 4 and 6 of the command line tool (code 5 is returned by `downgrade --check` and `save-as` when refused), the exceptions `RvtFileReader.Read` and `ReadStream` throw for input they cannot read (`ReadStream` also throws `ArgumentNullException` and `ArgumentException` for a missing, unreadable or non-seekable stream), and the check that raises them. |
| `RvtExitCodes`, `RvtInputException`, `RvtLimitException`, `RvtContainerCheck` | The exit codes 0 to 4 and 6 of the command line tool (code 5 is returned by `downgrade` and `save-as` when refused), the exceptions `RvtFileReader.Read` and `ReadStream` throw for input they cannot read (`ReadStream` also throws `ArgumentNullException` and `ArgumentException` for a missing, unreadable or non-seekable stream), and the check that raises them. |
| `FilteredElementCollector` | Query over the elements of a document (`OfCategory`, `WhereElementIsNotElementType`, `Where`, ...). |
| `RvtRevisionDiffer`, `RvtDiffOptions`, `RvtRevisionDiffResult` | `RvtIO.Diff`: compares two RVT files or opened `RvtDocument` revisions by persistent `UniqueId`, reporting additions, removals, parameter/type/placement/geometry/relationship/link changes, affected-instance impacts, ambiguous matches, and partial-decode gaps as deterministic JSON. See [revision comparison](diff.md). |
| `BuildingStoreyCatalog`, `BuildingStorey` | `RvtDocument.GetBuildingStoreyCatalog()` lists native project building storeys in order of elevation and Revit ID. Each storey carries its ID, name and resolved elevation in internal feet. `GetStoreyId(elementId)` uses the current IFC storey rules and returns null for an unknown element or one assigned to the building itself. Obtain a new catalog after editing levels. |
Expand Down
Loading
Loading