Skip to content

feat(ifc): draw family instances from the meshes Revit saved for display, opt-in (#255) (#227) (RE-78) - #420

Merged
DrunkOnJava merged 5 commits into
mainfrom
feat/saved-graphics-meshes
Sep 30, 2026
Merged

DrunkOnJava merged 5 commits into
mainfrom
feat/saved-graphics-meshes

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

Opt-in --saved-meshes for rvt-ifc and rvt-gltf: every body that is only its element record's bounding box is replaced by the mesh Revit saved for the element's display, read by rosejn's native saved-graphics reader from #255. The first commit is theirs, extracted with their authorship; the second integrates it. rosejn confirmed on #255 (2026-09-28) that it can be merged as it stands. Rebased onto main (5f5f89d) on 2026-09-30.

Motivation

Doors, windows, furniture and fixtures were boxes (#227: every Core Interior door 2.92 ft too deep). #255 decodes the graphics Revit saves per element, which are the family's real shape.

Changes

  • 22096f0 (author rosejn): the native document, element, parameter and saved-graphics modules the saved scene needs, from feat(parser): add native model attributes and geometry extraction #255 (32b806c). Changes on extraction: unit-test modules not included (repository policy); the built-in extensible-storage catalog disabled (provenance not recorded); malformed-input panics returned as errors; let-chains rewritten for MSRV 1.85; earcut held below 0.4.10, whose is_multiple_of needs Rust 1.87.
  • src/ifc/saved_meshes.rs: replaces record-box bodies (no resolved profile) with the saved mesh in the element's own placement. Aggregate wholes (stairs, curtain walls) keep their parts; a Tag shared by several entities is left alone.
  • SolidShape::TriangulatedFaceSet, written as one IfcCartesianPointList3D plus one IfcTriangulatedFaceSet (Snowdon: 111 MB, against 456 MB as IfcFacetedBrep). glTF and plan output mesh it through body_geometry.
  • rvt-ifc / rvt-gltf --saved-meshes; when the reader declines a file (Revit 2025: "native record framing is unvalidated") the export goes ahead with its boxes and says so. Diagnostics recount body sources.
  • tools/re/saved_meshes_vs_ifc.py, reports/element-framing/RE-78-saved-graphics-meshes.md, README, supported profile, support matrix (saved-graphics-meshes, experimental), CHANGELOG.

Testing

Per element world box against Revit's own IFC export (IfcOpenShell 0.8.5):

file elements within 0.01 ft, saved mesh within 0.01 ft, record box
Core Interior (2024): doors, windows, shading devices 158 158 0 doors
Snowdon Towers (2024): every replaced body 3,736 3,332 1,138

Snowdon residuals (in the report): windows 66 of 68 (Revit's export draws parts the Fine-detail mesh does not), light fixtures 0.58 ft taller, 30 members 13.33 ft low.

After the rebase (2026-09-30), on GitHub's runners: every required check, the MSRV 1.85 job, IfcOpenShell validation, corpus tier 2 and the wheel build pass, and Measure run 36717043673 (this branch against main) exports byte-identical IFC for Core Interior, Einhoven and the four RE1 models, with every scorer output unchanged. The Snowdon row is the measurement from before the rebase (that oracle is local-only).

  • fmt, clippy -D warnings, rustdoc -D warnings, cargo test --workspace --all-targets --all-features
  • corpus cargo test --profile ci --no-fail-fast --test '*'
  • cargo +1.85.0 check --profile ci --all-targets
  • default output unchanged: both Core Interior witness observations regenerate byte-identical
  • ifc_schema_arity.py on the Snowdon saved-mesh IFC (156,768 instances); GLB on Core: 16,188 to 47,000 triangles

Audit-honesty checklist

  • Opt-in and experimental: 37 s and 5.6 GB peak on Snowdon; Revit 2024 only
  • Residuals and the 2025 limitation documented
  • No emojis, private paths or PII; the Snowdon oracle stays local

Legal and contribution hygiene

Breaking changes

None. Off by default.

Related issues

Refs #255, #227. Credit: rosejn.

@DrunkOnJava DrunkOnJava added this to the 0.4.0: IFC geometry beta milestone Sep 27, 2026
@cursor

cursor Bot commented Sep 27, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_b60270da-b3df-4c97-9707-38246518cd9c)

@cursor

cursor Bot commented Sep 27, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_da7d28dd-58c6-424b-b923-85fe504e8ad6)

@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Brought up to date with main (72 commits) on 2026-09-28, and re-verified. This is a status note, not a request.

  • Rebased. @rosejn's reader commit applied unchanged and is still authored by him. Our two commits needed two documentation conflicts resolved (README, supported profile).

  • Ported. One new commit of ours: main moved to sha2 0.11, whose digests no longer format with {:x}, so five call sites in the native modules now format byte by byte. The fuzz workspace's lockfile gains earcut.

  • Gate: fmt, clippy, rustdoc, MSRV 1.85, the fuzz check, integration tests and the corpus run all pass.

  • Measured again with --saved-meshes, against Revit's own IFC exports (tools/re/saved_meshes_vs_ifc.py):

    • Core Interior: all 138 replaced doors and windows are within 0.01 ft.
    • Snowdon Towers: 2,191 of 2,566 replaced bodies are within 0.01 ft.

    Fewer bodies are replaced than when this draft was opened, because main now decodes more of them itself: turned instances, curtain parts along their axes, and Core's shading devices by their outline. Windows (2 of 44) and railings remain the weak classes, as the RE-78 addendum records.

As offered on #255, this stays a draft until rosejn is happy for it to be merged this way. Nothing else in the project waits on it.

@DrunkOnJava
DrunkOnJava force-pushed the feat/saved-graphics-meshes branch from 9dc507e to 4fff698 Compare September 28, 2026 17:41
@cursor

cursor Bot commented Sep 28, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_00050529-d689-4c5c-a1fb-170b9e6fb0ea)

rosejn and others added 4 commits September 30, 2026 08:40
rosejn's reader for Revit's own object graph and the graphics a file saves
for display, extracted from #255 (32b806c): the schema registry, the
document and element graph, parameters, extensible storage, and the saved
mesh and material decoders the saved scene needs.

Changes made on extraction:
- the unit-test modules are not included (the repository adds no unit
  tests; this work is measured end to end instead);
- the built-in extensible-storage catalog is disabled, as its provenance
  is not recorded;
- missing element flags and empty boundary edges return errors instead of
  panicking, and NaN-safe sorting replaces partial_cmp().unwrap();
- let-chains are rewritten for the 1.85 MSRV, and earcut is held below
  0.4.10, whose is_multiple_of needs Rust 1.87.
@DrunkOnJava
DrunkOnJava force-pushed the feat/saved-graphics-meshes branch from 4fff698 to fd8d995 Compare September 30, 2026 12:44
@cursor

cursor Bot commented Sep 30, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_01eeec2d-c6bd-41fa-9818-870c2ef30da9)

@DrunkOnJava
DrunkOnJava marked this pull request as ready for review September 30, 2026 12:51
@DrunkOnJava
DrunkOnJava merged commit 7386177 into main Sep 30, 2026
25 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/saved-graphics-meshes branch September 30, 2026 13:01
DrunkOnJava added a commit that referenced this pull request Nov 6, 2026
… the 20 plates and 116 rooms were outlines before the option landed (#1492) (#1508)

## Summary

RE-78 counted 158 saved-mesh bodies on Core Interior (132 doors, 6
windows, 20 shading devices); `mesh_bodies_vs_ifc` and `rvt-ifc
--saved-meshes` count 138. Nothing changed on `main`: the 158 was
measured on 2026-09-27, when the 20 plates and the 116 rooms were record
boxes. RE-95 (#467, 6e0dfaa) closed the plates' sketch outlines and
RE-101 (#473, 68a44c0) gave the rooms their stored-solid outlines on
2026-09-28, and `saved_meshes::attach` replaces only a body whose
`ProfileResolved` is false, as it did at 7386177, the first commit on
`main` with `--saved-meshes`. No export changes and no body that
measured exact was lost.

## Motivation

#1492: the pages were corrected to 138 of 138 in #1484 without saying
why the 20 stopped being scored.

## Changes

- `reports/element-framing/RE-78-saved-graphics-meshes.md`: the result
line stops naming the shading devices, the Core Interior shading-device
row says it is from before RE-95, and a dated note under the first table
gives the commits and the rule. The Snowdon rows are said to be from the
same earlier tree, local only and not re-run.
- `tools/re/shading_bodies_vs_ifc.py`: `mesh_bodies_vs_ifc` with every
`IfcShadingDevice` selected whatever its `BodySource`, and a count of
the `BodySource` and `ProfileResolved` of the plates before its table.
Run by name through `-f scorers=` (as `slab_bodies_vs_ifc` is); not in
the standing scorer list.
- `changelog.d/research/1492-shading-plates-not-saved-meshes.md`.

## Testing

Unit tests are banned in this repository; none added.

- [x] Commit found by reading, not inferred from dates: `git merge-base
--is-ancestor 6e0dfaa 7386177` and `... 68a44c0 7386177` both hold,
`git show 7386177:src/ifc/saved_meshes.rs` has the `||
profile_resolved` skip (line 75), and PR #420's own body says its Core
Interior row (158) is from before its rebase onto `main`. The Measure
run that body cites (36717043673) exported IFC byte-identical to
`main`'s, so it did not draw the meshes and did not re-measure the 158.
- [x] Measure run 41850769925 (`--saved-meshes`, `e024f03c`): `rvt-ifc`
prints `138 of 138 bounding-box bodies drawn from their saved graphics`,
and `mesh_bodies_vs_ifc` and `saved_meshes_vs_ifc` score 132 doors and 6
windows, no shading device.
- [x] The new scorer, run on Revit's small Core Interior IFC against
itself (one shading device): selects it and scores ratio 1.0000. That
checks the selection, not rvt-rs.
- [x] Measure run 42133202790 (filtered: `core-interior`, `-f
ifc_flags=--saved-meshes`, scorers `plan_profiles_vs_ifc
mesh_bodies_vs_ifc saved_meshes_vs_ifc shading_bodies_vs_ifc`; code
`daf36102`, scorers from `3fb0d241`; success), read back:
- The 20 plates are `BodySource` `partition_element_record_bbox` with
`ProfileResolved` true (the record-box source stays on a body whose
outline is resolved).
- Shape against Revit's body of the same Tag (`shading_bodies_vs_ifc`):
volume within 0.01% on 20 of 20, every vertex within 0.001 ft both ways
on 20 of 20, Revit's vertices on rvt-rs's surface on 20 of 20; the
largest distance 1.539e-06 ft (10 `Floor:Structural Slab`, 10
`Floor:Arch Topping Slab - 2"`).
- Plan outline (`plan_profiles_vs_ifc`): area within 0.1%, vertices and
outline within 0.01 ft, 20 of 20 (and 80 of 80 `IfcSlab`).
- `mesh_bodies_vs_ifc` and `saved_meshes_vs_ifc` score 138 bodies (132
doors, 6 windows), no plate and no room; `rvt-ifc` prints `138 of 138
bounding-box bodies drawn from their saved graphics`.
- Not measured: the plates' saved meshes against Revit's (the option
leaves the plates alone, so no run draws them), and the rooms' shape
(Revit's export holds no spaces to score them against).

## Audit-honesty checklist

- [x] The docs say what was and was not measured; the plates' shape
figure is labelled not yet measured on this head
- [x] A fragment under `changelog.d/research/`
- [x] No emojis, private paths or PII

## Legal and contribution hygiene

- [x] Apache-2.0; no Autodesk source; no new fixtures

## Breaking changes

None. No `src/` change, no export change.

## Related issues

Closes #1492.
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.

2 participants