Skip to content

feat(viewer): draw doors and windows from their saved meshes, with a toggle - #1150

Merged
DrunkOnJava merged 4 commits into
mainfrom
feat/viewer-saved-meshes
Oct 30, 2026
Merged

DrunkOnJava merged 4 commits into
mainfrom
feat/viewer-saved-meshes

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

The browser viewer draws the doors and windows of Revit 2023 to 2027 files from the meshes Revit saved for them, as rvt-ifc and rvt-gltf do by default, with a "Draw doors and windows from saved meshes" option in File status that keeps their boxes. Its memory and load time are measured in Playwright on the reference models (below).

Stacked on #1146: the first commit is that PR's (default_scope, the Python package) and shows here until it lands. This PR's commit is the second.

Motivation

Since 0.11.0 the CLIs draw doors and windows from their saved meshes, so what the viewer showed and exported (glTF and IFC) differed from the command line's for the same file. Griffin decided on 2026-10-30: "Python and viewer follow the CLI default, with an opt-out; the viewer's memory and load time are measured in Playwright on the reference models before it lands."

Changes

  • rvt-wasm/src/lib.rs: openRvtBytesWithDiagnosticsMode and openRvtBytesWithDiagnosticsModeAndOpenLimits attach the default saved meshes after the export (ifc::saved_meshes::default_scope, attach_scoped_with_control, then recount_exported and record_unread_streams, as rvt-py does). The options object gains savedMeshes?: boolean (default true; false keeps the boxes and skips the pass). When the saved graphics cannot be read the model keeps its boxes and the diagnostics carry a warning. No binding added, no signature changed (tools/ci/wasm-api.py compat and docs pass).
  • viewer/index.html, src/main.ts, src/styles.css: the option in File status, on by default, on the existing checkbox style; changing it reopens the open file with savedMeshes and the file's own limits (a large-model retry stays large-model); it is disabled while a file loads. ?savedMeshes=0 starts it off. The Shapes row says how many bodies came from saved meshes.
  • viewer/src/worker.ts: reports what an open cost (the wasm open call, the whole worker, the wasm memory after the parse, the worker heap); main.ts keeps it with the load time in data-load-stats on #status.
  • viewer/tests/saved-meshes-measure.spec.ts, playwright.config.ts, .github/workflows/deploy-viewer.yml: the measurement (below). It runs alone (RVT_VIEWER_MEASURE=1, one worker) after the suite, and the JSON is uploaded as the viewer-saved-meshes-measurement artifact.
  • docs/viewer-api.md, viewer/README.md, changelog.d/changed/viewer-saved-meshes.md.

?savedMeshes=0 differs from ?maxStreamBytes= on purpose: the limits describe one file and apply to the first open only, but the option is a visible toggle, which would otherwise turn itself back on after one file. It applies to every open until the toggle is changed.

Testing

Unit tests are banned in this repository: none added. No local build or test runs (the repository's rule); GitHub's runners are the gate.

  • tools/check-local.sh passes: not run locally (the repository's rule); CI passed is green
  • Verified end to end on real Revit files: Core Interior, Einhoven (MIT, magnetar-io/revit-test-datasets) and RE1's four models (MIT, Drshelden/IFC-ECS), opened in the viewer by tests/saved-meshes-measure.spec.ts (reproduce: RVT_VIEWER_MEASURE=1 pnpm exec playwright test in viewer/, or run Deploy viewer); the table below is its output
  • Not an IFC exporter change (the viewer's wasm adds the CLI's existing saved-mesh step); no witness replay
  • Not a performance change in the library; the cost is measured, not tuned

Measurement

From Deploy viewer run 41072412126 at 60f0c44 (the second commit only drops a column and edits the changelog fragment). Chromium 156 on GitHub's ubuntu-24.04 runner (4 CPUs), one open per setting, each in a fresh browser context, the setting order alternating by model. tests/saved-meshes-measure.spec.ts ran alone after the suite; its JSON is the viewer-saved-meshes-measurement artifact of that run.

Model Revit File MiB Saved meshes Load s Open s Wasm MiB Page heap MiB Doors and windows from meshes Box bodies
2024_Core_Interior 2024 32 off 24.5 23.4 324 20 0 of 138 138
2024_Core_Interior 2024 32 on 25.6 24.3 324 30 138 of 138 0
Revit_IFC5_Einhoven 2023 1 off 0.9 0.7 23 7 0 of 2 11
Revit_IFC5_Einhoven 2023 1 on 1.0 0.7 23 7 2 of 2 9
RE1-Architecture 2025 6 off 6.8 6.5 100 9 0 of 5 57
RE1-Architecture 2025 6 on 7.1 6.8 100 9 5 of 5 52
RE1-Mechanical 2025 3 off 3.6 3.3 67 7 0 of 0 68
RE1-Mechanical 2025 3 on 3.8 3.4 67 7 0 of 0 68
RE1-Plumbing 2025 3 off 3.5 3.1 60 11 0 of 0 61
RE1-Plumbing 2025 3 on 3.6 3.2 60 9 0 of 0 61
RE1-Electrical 2025 13 off 8.1 7.8 170 7 0 of 0 49
RE1-Electrical 2025 13 on 8.0 7.7 170 8 0 of 0 49

Load is the click to the loaded model as the viewer measures it; open is the wasm open call alone, where the saved graphics are read; wasm is the linear memory after the whole parse (it only grows, so it is the peak against the 4 GiB a tab can hold); page heap is the main thread's JavaScript heap after the load.

  • Repeated on this PR's head, 2c5d1c5 (run 41075018095): Core Interior 24.5 s off, 25.4 s on, 324 MiB both; RE1 Architecture 6.7 s and 7.0 s, 100 MiB both; Einhoven 0.9 s and 1.0 s, 23 MiB both; page heap 20 to 34 MiB on Core Interior. All 7 measurement tests and the 31-test suite pass in both runs.
  • Time: the saved meshes cost 1.1 s of Core Interior's 24.5 s (4%), 0.3 s on RE1 Architecture and 0.1 s on Einhoven. The three RE1 models with no doors or windows have no candidate, so the pass reads nothing; their on-off differences (-0.1 to +0.2 s) are the noise of one run each, which also bounds how far to trust the first three.
  • Memory: the wasm memory is identical with the option on and off on every model (324 MiB for Core Interior's 32 MiB file, about ten times the file), so the saved-graphics pass stayed inside the peak the export had already reached. The page holds 10 MiB more on Core Interior (20 to 30 MiB), the 138 door and window meshes in the model it keeps.
  • The spec asserts, on every model, that off draws no saved-mesh bodies, that on draws only doors and windows, keeps the same elements, and removes exactly as many bounding boxes as it draws meshes, and that on Core Interior it draws at least one. A second test checks the toggle: it reopens the open file, off gives 0 meshes and 138 boxes back, on again gives the same 138.
  • Not measured: a model near the 4 GiB ceiling. The largest model Deploy viewer has is Core Interior; the BIM4LCA office and Snowdon Towers are not fetched there. A file the export barely fits could in principle fail in the saved-graphics pass, which cannot degrade to boxes the way a read error does (a wasm out-of-memory is a trap); the toggle stays available after a failed open, and turning it off reopens the file without the pass.
  • Pins: none moved. The journey spec's counts against the CLI's pinned manifests (material_count, by_ifc_type, IFCPROPERTYSET, IFCRELFILLSELEMENT, Einhoven's building_elements_with_geometry) pass unchanged with the option on by default.

Audit-honesty checklist

  • README / docs reflect the current state after this PR (docs/viewer-api.md, viewer/README.md); the root README's v0.11.0 list is left alone
  • Changelog fragment changelog.d/changed/viewer-saved-meshes.md
  • No limitation resolved or introduced beyond the cost measured above
  • Commit message describes what and why
  • No emojis, no private paths or personal addresses in committed files
  • Not a reverse-engineering finding

Legal and contribution hygiene

  • Apache-2.0
  • No Autodesk proprietary source, decompiled internals or NDA'd SDK content
  • No new fixtures; the spec reads the models CI already fetches (MIT)

Breaking changes

None. The wasm bindings keep their signatures; savedMeshes is an optional field of the options object, and the viewer is the only caller.

Screenshots or output samples

The measurement above. The option sits under the status panel in File status.

Related issues

Refs #1146.

…ifc does

Since 0.11.0 rvt-ifc and rvt-gltf draw the doors and windows of Revit 2023
to 2027 files from their saved meshes; Python's write_ifc() and rvt_to_ifc()
kept their bounding boxes, so the 0.11.0 wheel's IFC differed from the
CLI's for the same file. Griffin decided on 2026-10-30 that Python and the
viewer follow the CLI's default.

rvt::ifc::saved_meshes::default_scope now holds the default (doors and
windows on Revit 2023 to 2027) for every caller; rvt-ifc and rvt-gltf use it
unchanged. Python's write_ifc(), rvt_to_ifc(), export_diagnostics(),
export_diagnostics_json() and rvt_to_ifc_diagnostics() take saved_meshes=True,
attach the meshes and recount the diagnostics as rvt-ifc does; False keeps
the boxes, and a RuntimeWarning says when the saved graphics could not be
read.
…toggle

Since 0.11.0 rvt-ifc and rvt-gltf draw the doors and windows of Revit 2023
to 2027 files from the meshes Revit saved for them; the viewer still drew
their bounding boxes, so what it showed, exported as glTF and exported as
IFC differed from the command line's for the same file. Griffin decided on
2026-10-30 that the viewer follows the CLI's default, with an opt-out, and
that its memory and load time are measured in Playwright on the reference
models before it lands.

rvt-wasm: openRvtBytesWithDiagnosticsMode attaches the default saved meshes
after the export, and the options of openRvtBytesWithDiagnosticsModeAndOpenLimits
gain savedMeshes (default true; false keeps the boxes). When the saved
graphics cannot be read the model keeps its boxes and the diagnostics carry
a warning. No binding is added and no signature changes.

Viewer: File status has a "Draw doors and windows from saved meshes" option,
on by default; changing it reopens the open file, and ?savedMeshes=0 starts
with it off. The worker reports the open's cost (the wasm open call, the
wasm memory after the parse, the worker heap) and the viewer keeps it with
the load time on #status. The Shapes row says how many bodies came from
saved meshes.

tests/saved-meshes-measure.spec.ts opens each reference model with the
option on and off in a fresh browser context, asserts behaviour (off draws
none, on draws only doors and windows and replaces boxes one for one, and
the toggle reopens the file), and writes the figures to
measurements/saved-meshes.json and the job summary. Deploy viewer runs it
alone after the suite and uploads the JSON.
…d put the measured cost in the changelog

performance.memory does not exist in a dedicated worker, so the worker heap
column of the saved-mesh measurement was null on every model (Deploy viewer
run 41072412126). The wasm memory, the load time and the page heap stay.

The changelog fragment now carries the measured cost of the saved meshes.
@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Owner review. After the update onto main (#1146 has landed), the diff is the viewer change alone: rvt-wasm, the File status option, the worker's load stats, the measurement spec and its CI step.

  • wasm: it follows rvt-py's path: default_scope, attach_scoped_with_control, recount_exported, then record_unread_streams, which also recounts warning_count after the failure warning. savedMeshes is an optional field of the existing options object, so no binding changes and wasm-api.py compat passes.
  • UI: the option reuses the category toggles' style and the existing --sx-* tokens, adds no colours, and its label and hint are in sentence case. It is disabled while a file loads and keeps a large-model retry's limits when it reopens.
  • ?savedMeshes=0 holding for every open, where ?maxStreamBytes= applies to the first only, is right for a visible toggle.
  • Measurement (Griffin's condition for landing): Deploy viewer runs 41072412126 and 41075018095 agree. On Core Interior the meshes cost about 1 s of 24.5 s and no wasm memory (324 MiB on and off); every model's peak is unchanged. Not measured, as the body says: a model near the 4 GiB ceiling, where the extra pass could trap. Turning the option off after a failed open reopens without it.
  • Pins: the journey spec's counts against the CLI manifests are unchanged with the option on.

Nothing to fix.

@DrunkOnJava
DrunkOnJava marked this pull request as ready for review October 30, 2026 15:07
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 30, 2026 15:07
@DrunkOnJava
DrunkOnJava merged commit ee0398e into main Oct 30, 2026
30 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/viewer-saved-meshes branch October 30, 2026 15:11
Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 31, 2026
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