Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
2d6bf4f
Read framed RVT partitions through scratch storage
mahach666 Nov 24, 2026
4c55a05
Use wide offsets for streamed partition framing
mahach666 Nov 24, 2026
20196dd
Report geometry block progress during RVT reads
mahach666 Nov 24, 2026
e5d07ce
Reuse partition scratch ranges for framed geometry
mahach666 Nov 24, 2026
598629c
Reject invalid GRep probe fields without exceptions
mahach666 Nov 24, 2026
331ee27
Read raw element record bodies from partition scratch
mahach666 Nov 24, 2026
c928b75
Translate Revit layouts a record at a time
mahach666 Nov 24, 2026
472eb7a
Validate large framed partitions without the array limit
mahach666 Nov 24, 2026
2bbca3f
Reject truncated geometry probe values without exceptions
mahach666 Nov 24, 2026
c237af3
Release temporary RVT scan data after use
mahach666 Nov 24, 2026
8e0f73f
Keep deferred parameter roots as partition references
mahach666 Nov 24, 2026
8560ffb
Replay scratch-backed RVT geometry blocks on demand
mahach666 Nov 24, 2026
104a93b
Spool decoded RVT parameter records to scratch
mahach666 Nov 24, 2026
c312fb7
Report progress for RVT model construction
mahach666 Nov 24, 2026
31329a9
Keep RVT scene triangle buffers in seekable scratch
mahach666 Nov 24, 2026
aa9b573
Archive expanded RVT faces while constructing the scene document
mahach666 Nov 24, 2026
98a0d66
Reduce resident geometry and indexes during scene finalization
mahach666 Nov 24, 2026
dbd04d6
Reduce parameter provenance and temporary allocations in scene reads
mahach666 Nov 24, 2026
e71fff9
Measure RVT shells without reloading archived face lists
mahach666 Nov 24, 2026
c5cb2fc
Allocate detail-level quantity buffers only when measured
mahach666 Nov 24, 2026
7bf77a2
Page decoded RVT records and defer fallback definitions
mahach666 Nov 24, 2026
355fa1c
Page resolved scene parameters and release consumed parser values
mahach666 Nov 24, 2026
f875415
Bound RVT name scans and report record and name chunk progress
mahach666 Nov 24, 2026
40a24c7
Keep parameter pages archived through scene product filtering
mahach666 Nov 24, 2026
4960241
Check packed scene parity on a real Revit 2025 model
mahach666 Nov 24, 2026
1dfa342
Reuse the serialization buffer for decoded native parameters
mahach666 Nov 24, 2026
0a9d16d
Report RVT geometry recovery and retain only the first scene scan name
mahach666 Nov 24, 2026
ada184c
Allocate specialized element tuples only when present
mahach666 Nov 24, 2026
d2732b3
Replay geometry from original scratch ranges during recovery
mahach666 Nov 24, 2026
bc97efd
Reuse canonical definitions when building RVT parameters
mahach666 Nov 24, 2026
7f9e2b3
Page resolved build values and avoid retaining export-only wall bodies
mahach666 Nov 24, 2026
577f768
Keep element parameters paged through construction and resolution
mahach666 Nov 24, 2026
27721ff
Report distinct RVT model finalization passes
mahach666 Nov 24, 2026
a3e0dff
Release parameter pages after each element in model resolution
mahach666 Nov 24, 2026
d564fb5
Count type reference votes without per-element dictionaries
mahach666 Nov 24, 2026
1e3b8b4
Keep RVT phase and quantity resolution on parameter pages
mahach666 Nov 24, 2026
edd0551
Bound page allocations in design option and placement resolution
mahach666 Nov 24, 2026
7ae830d
Reuse scratch ranges for wall geometry recovery
mahach666 Nov 24, 2026
db654f9
Keep worksharing ownership edits on parameter pages
mahach666 Nov 24, 2026
b8afbb7
Report drawable element progress during RVT mesh extraction
mahach666 Nov 24, 2026
3bc2365
Keep host and system labels on RVT parameter pages
mahach666 Nov 24, 2026
f779ea9
Reuse reserved scratch slots for revised parameter pages
mahach666 Nov 24, 2026
472fb30
Allocate drawing and stair fields only for relevant RVT elements
mahach666 Nov 24, 2026
fd682de
Archive large RVT element reference lists for paged scenes
mahach666 Nov 24, 2026
3d7b880
Keep initial type and elevation resolution on parameter pages
mahach666 Nov 24, 2026
5bb007f
Release raw name candidates before assembling paged scenes
mahach666 Nov 24, 2026
a8e511c
Resolve archived RVT references without loading unrelated parameter l…
mahach666 Nov 24, 2026
6e4aee3
Allocate wall and curtain fields only for elements that use them
mahach666 Nov 24, 2026
9aeef5b
Read exact scratch ranges and release parsed inputs after use
mahach666 Nov 24, 2026
03e916d
Avoid unnecessary allocation while building paged RVT scenes
mahach666 Nov 24, 2026
91658c5
Allocate optional MEP, room, and type facts on demand
mahach666 Nov 24, 2026
b77aa27
Allocate RVT curve and placement facts only when present
mahach666 Nov 24, 2026
08c3a3e
Write derived RVT property edits back to scratch per element
mahach666 Nov 24, 2026
ec09246
Resolve paged scene facts without replaying unrelated records
mahach666 Nov 24, 2026
9f9a43f
Page temporary native field edits during category resolution
mahach666 Nov 24, 2026
39c00e4
Check the surface block length before reading its envelope on replay
mahach666 Nov 25, 2026
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
29 changes: 26 additions & 3 deletions docs/public-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ projects through `InternalsVisibleTo`.
|---|---|
| `RvtDocument` | Opens a file (`Open`) or a readable, seekable stream (`OpenStream`), saves a verified lossless copy (`SaveAs`), and gives the elements, project information, file metadata and category lookups. A document opened from a stream has no `SourcePath`: `SaveAs` throws `InvalidOperationException`, and printing cannot read the images it takes from the file (the title block logo and the picture of a rendering view). |
| `RvtFileReader` | Lower level read that returns the `RevitFileInfo` behind a document. `Read` takes a path and `ReadStream` reads from the beginning of a readable, seekable stream, whatever its position. The stream is only read: it is never written to, shortened or closed, also when it is writable. A failure of the stream itself is thrown as the stream threw it. |
| `RvtReaderOptions` | Options of a read, including `DiagnosticOutput`, `Progress` (see below), `ResolveCurrentCopies` (keeps only the current copy of an element that several partition streams hold; default true, set it to false to decode every copy), `RaiseLimits` and `Diagnostics`. `RevitLocalizationDirectory` is `[Obsolete]` and ignored: the texts are built in. |
| `RvtReaderOptions` | Options of a read, including `DiagnosticOutput`, `Progress`, `CreatePartitionScratch`, `ResolveCurrentCopies` (keeps only the current copy of an element that several partition streams hold; default true, set it to false to decode every copy), `RaiseLimits` and `Diagnostics`. `RevitLocalizationDirectory` is `[Obsolete]` and ignored: the texts are built in. |
| `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). |
Expand All @@ -19,6 +19,23 @@ projects through `InternalsVisibleTo`.
| `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. |
| `GridAxis` | `RvtDocument.GetGridAxes()` lists decoded project axes in Revit ID order. A circular or multi-segment axis has ordered analytic segments. `GridAxis.Tessellate(maxErrorFeet)` returns path points in internal feet. |

`RvtReaderOptions.CreatePartitionScratch` can return a new, empty stream for the current read. The stream must support reading,
writing and seeking. RvtIO writes inflated partition segments to it, reads them back in windows and disposes it before the read
returns or throws. Use private temporary storage outside managed memory to reduce the reader's working set. With a null factory,
segments are kept in memory.

Exact framing is validated in both modes. Layout translation reads the partition by item and writes completed chunks to scratch
when configured. Raw element record bodies and geometry blocks are read back from their byte ranges in those chunks, including
ranges that cross chunk boundaries. A bounded whole-chunk cache serves full scans and supplies any ranges it already holds. The parser
stores decoded parameter records individually in scratch and reads them by element ID. Paged scene reads also keep the
resolved value maps used to build elements in scratch. Recovery of damaged framing and bytes
outside the layout grammar can still require a whole partition in memory. The returned document and its geometry are built in
memory.

With a scratch factory, `ReadStream` can validate and decode an exactly framed partition stream larger than one array.
The reader also stores decoded element-record references and field vectors on pages in that stream during a scratch-backed read.
The array-size limit still applies to other streams and to compressed partitions that require the recovery scanner.

`RvtReaderOptions.Progress` observes one `RvtFileReader.Read` or `ReadStream`. The reader calls `IProgress<RvtReadProgress>.Report`
synchronously on the thread that calls `Read` or `ReadStream`, one call at a time and in phase order, and does not catch an exception the
observer throws: it ends the read and reaches the caller as it was thrown, so an observer can cancel by throwing.
Expand All @@ -33,8 +50,14 @@ reports them in this order and never returns to an earlier phase. A file can ski
`wide-model` (no counts) only when `PreserveWideLayout` also parses the model of the wide layout first.
`class-schema` covers reading the file's own class schema, its element table records and the episode table;
`r22-layout` is the rewrite that follows, which can take as long as the phases around it.
`Completed` and `Total` count partition streams (`partitions`), the streams the rewrite reads (`r22-layout`), block scan
passes (`element-blocks`) or decoded stream bytes (`parameter-stream`). `Completed` does not decrease within a phase.
`Completed` and `Total` count partition streams (`partitions`), the streams the rewrite reads (`r22-layout`), data chunks scanned
for records or names (`element-records`, `element-properties`), block scan and recovery passes
(`element-blocks`, `recover-geometry`), decoded stream bytes
(`parameter-stream`), element candidates processed (`build-model`) or completed resolution passes (`finalize-model`).
`Completed` does not decrease within a phase.
`GeometryBlocks` optionally gives the processed and queued geometry blocks within the current block pass. Such updates
repeat the pass number while the block count advances. Geometry recovery passes cover decoding blocks from the main
walk, locating additional blocks, decoding those blocks, and recovering planar wall bodies.
A zero total means the reader has no work count for that update. Counts describe units within one phase. `complete`
(1 of 1) is the last update of a read.

Expand Down
20 changes: 19 additions & 1 deletion docs/scene.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,25 @@ closed one is an `ArgumentException`.
Set `RvtSceneOptions.ReadProgress` to observe the reader phases and work counts during `Read(path)`; it is the
`RvtReaderOptions.Progress` of that read (see [the public API](public-api.md)), including its guarantees on order and thread.
Pass an `IProgress<RvtReadProgress>` of your own when order matters, as `Progress<T>` can deliver updates late and out of order.
The final reader update, `complete`, marks the end of the file read. Mesh extraction and scene mapping follow it and report nothing.
The final reader update, `complete`, marks the end of the file read. Set `RvtSceneOptions.MeshProgress` to receive completed
and total drawable element counts during mesh extraction. Updates are reported on the calling thread. An empty drawable set
reports `(0, 0)` once. Scene mapping follows mesh extraction.

`RvtSceneOptions.CreatePartitionScratch` passes a scratch stream factory to the file reader for path and stream reads. Use it to
read inflated partitions through private temporary storage as described in the [public API](public-api.md).

Use `ReadStream(stream, options, triangleScratch)` to keep expanded body faces, large element reference lists, resolved parameters, intermediate triangle meshes and
the scene's triangle buffers in another temporary stream. Pass an empty, readable, writable, seekable stream; the caller owns it and
keeps it open until it has finished using the returned scene. It must be separate from the input and partition scratch.
Parameter edits reuse their reserved slots in this stream. A slot moves to a larger allocation when its contents grow beyond its capacity.
Derived curve, sheet, room and instance properties are written back as each element is updated, keeping the edited parameter lists out of the managed heap between updates.
The partition scratch also holds provisional native field edits until category resolution determines which edits apply.
The archived lists also retain the first type references, the kinds of zero-ID references, the first positive creation phase, and whether a host quantity placeholder needs removal.
Geometry block indexes carry the available detail alternatives alongside symbol links. Quantity checks inspect the index before decoding geometry.
During this read, analytic mesh nodes retain the facts needed for element measurements. Shell quantities and scene tessellation read the archived polygons through the same paged face lists.
The temporary scene document keeps the resolved parameter values and omits the provenance indexes used by the compact API and IFC export.
Element records allocate storage for optional MEP, room, validated type-reference, curve driver, and instance placement facts when those facts are present.
Revit UniqueIds from creation history are formatted when their elements are mapped to the scene.

Set `RvtSceneOptions.IncludeModelLinesAndReinforcement` to include straight model lines as line primitives and reinforcement with decoded bar paths as triangles. The native RVT-to-NWC tool enables this option.

Expand Down
8 changes: 8 additions & 0 deletions src/RvtIO.Scene/RvtSceneOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ public sealed class RvtSceneOptions
/// order and thread; the last update, <c>complete</c>, ends the file read, and the meshes and the scene are built after it.</summary>
public IProgress<RvtReadProgress>? ReadProgress { get; set; }

/// <summary>Receives completed and total drawable element counts during mesh extraction, on the calling thread.
/// Starts at zero and ends when the drawable elements are processed, before mapping them into the scene.</summary>
public IProgress<(int Completed, int Total)>? MeshProgress { get; set; }

/// <summary>Opens scratch storage for inflated partitions when the scene reader opens a file.
/// The factory follows the contract of <see cref="RvtReaderOptions.CreatePartitionScratch"/>.</summary>
public Func<Stream>? CreatePartitionScratch { get; set; }

/// <summary>Includes straight model lines and reinforcement described by its centre lines.</summary>
public bool IncludeModelLinesAndReinforcement { get; set; }

Expand Down
Loading
Loading