Repository navigation
fix(viewer): the Schedule and info panels show each element on the storey the IFC writes it in (#1422) - #1423
Merged
Conversation
…orey the IFC writes it in (#1422) build_schedule, element_info_panel and build_scene_graph took an element's storey from its own storey_index and listed the further pieces of an element of separate loops, which the export writes as items of the owner's body. They now read the writer's own decision, step_writer::placements and storey_of, as the MCP server, the rooms schedule and the elements CSV do (#1412, #1417): a part of a stair, a railing or a curtain wall is on its whole's storey, an element in a room on the room's, an opening on its host's, and a folded piece has no schedule row and no tree node. A drawn folded piece that a click picks gets the panel of the element whose body it is part of. A door or window is nested under its host only where both are on the same storey. probe_1422_viewer_panel_levels counts, for one model, the rows removed and the elements whose storey moves in the schedule, the tree and a sample of panels, and checks each against the placements.
DrunkOnJava
marked this pull request as ready for review
November 5, 2026 06:58
… the whole element, the tree has no lost host rings (#1422) Review of #1423: - element_info_panel leaves out the size rows and the Profile row of an element with folded pieces, as the elements CSV leaves its size cells empty, and does not list "extents" as missing; ElementInfoPanel gains entity_index, the written element's index. - The viewer selects that element when a click picks a drawn folded piece, and a highlight, a zoom and a category's highlight and framing cover the pieces of every owner they reach. The category list counts the elements the tree lists, and a part of several wholes sits under the first, as the export has it. - build_scene_graph gives an element no chain of hosts reaches (two that host each other) a node of its own storey. - Docs and the fragment: the wording of what a part is, the measurement clause, the leftover statements of the old storey rule. - probe_1422_viewer_panel_levels counts the panels whose size rows are left out and checks the panel's entity_index and extents.
4 of 7 tasks
…heir owner (#1422) model.body_pieces lists the pieces of every owner, but the export folds a piece only where the owner's body and the piece's are both plain; a piece with a solid or a saved mesh stays an element with its own tree row. writtenElementOf and bodyPiecesOf treated every entry as folded, so a click on such a piece selected its owner and an owner's highlight and zoom lit an element with its own row. They now take the elements the scene graph lists as the written ones: a listed index is its own element and a listed piece is not one of its owner's.
Merged
4 tasks done
DrunkOnJava
added a commit
that referenced
this pull request
Nov 5, 2026
…how many pieces were folded (#1424) (#1425) ## Summary `exported.building_elements`, `exported.by_ifc_type` and the other per-element counts of the export diagnostics now count the elements the IFC writes (what `step_writer::placements` says is written), and the new `exported.body_pieces_folded`, by STEP entity type, counts the pieces the writer folds into another element's body (`Placement::Folded`, #823). The figure of `building_elements` and `by_ifc_type` from before is the new one plus it. ## Motivation #1424: the diagnostics counted the folded pieces as elements, which the IFC does not write. Measure run 41977947391 (head 2fc83c4, before this change): 158 `IFCCOVERING` on the BIM4LCA office as built (122 at permit) in `by_ifc_type` where the IFC and Revit's export hold 111 (75), and 13,021 (13,067) `building_elements` where the MCP server lists 12,974 (13,020). The MCP server (#1412), the elements CSV (#1421) and the viewer's panels (#1423) already follow the writer. ## Changes - `src/ifc/mod.rs`: `exported_model_diagnostics`, `model_decisions`, `geometry_gap_skipped_items` and `pset_property_value_count` skip a piece marked `Placement::Folded`; the first tallies it in the new `ExportedModelDiagnostics::body_pieces_folded` (`#[serde(default)]`, appended at the end). - Which counts changed (a folded piece clones its owner's property set, storey, location and extrusion, so it was in each of them): - `exported`: `building_elements`, `by_ifc_type`, `building_elements_with_geometry`, `body_sources`, `bounding_box_bodies`, `bounding_box_spaces`, the four refusal maps, `resolved_outline_spaces`, `approximate_outline_spaces`. On the office as built `body_sources` summed to exactly 13,021 = `building_elements` (run 41977947391), so leaving the pieces in either would break that identity, and in `building_elements_with_geometry` it would break `geometry_element_fraction`. - The `skipped` geometry-gap items (`unsupported_geometry_*`, `floor_boundary_annotation_only`, `opening_index_without_host_geometry`) and the decisions made with them: a gap of an owner was counted once more for each piece, and a piece's `Ceiling...:2` name was in `sample_names`. - `decoded.parameter_value_count`: it counted the `Pset_` values of the sets `add_piece_sets` clones onto a piece, none of which `write_step` emits. Measured in run 41989882391: 54,952 to 54,764 as built and 55,145 to 54,957 at permit (188 fewer on each file, 4 for each of the 47 pieces), equal to the `Pset_` values in the IFC file. - The decisions of `--export-decisions` follow the counts they total. - Derived, so they move with `building_elements`: `source_coverage.exported_element_fraction`, `geometry_element_fraction`, the element terms of `confidence.score` when `unexported_element_records` is non-zero, and the `partial_element_geometry` test. - Unchanged: `storey_bound_elements` (already excluded), `building_elements_carried_by_parts`, `material_count`, `storey_count`, `layered_element_count` (keyed by ElementId), `wall_cut_openings_left_out`, `unit_assignment_count`, `total_entities` (entities: the pieces stay in the model for the glTF and the viewer). - `rvt-mcp`: the descriptions of `open_model` and `get_summary` said the diagnostics' `exported` counts include the pieces; they now say `exported.body_pieces_folded` holds them. `export_gltf` reports the IFC's `building_elements` and `entity_counts` (one count path); its glb also draws the pieces, so its `notes` say how many it draws beyond them when there are any, and its description and the `ExportOut.building_elements` doc say so. The tool descriptions (`open_model`, `get_summary`, `export_gltf`) and the output-schema docs (`ElementCounts.folded_into_bodies`, `ExportOut.building_elements`) change, so `docs/mcp-tools.json` and `docs/mcp-tools.md` need the CI contract sync again (not hand-edited). - `tools/re/mcp_answers_vs_ifc.py`: `building_elements` is `total - openings` and `by_ifc_type` the summary's, exactly; `exported.body_pieces_folded` equals the summary's `folded_into_bodies`; new check "parameter values": `decoded.parameter_value_count` equals the property values in the IFC's `Pset_` sets (first time measured on every model; `tests/parameter_diagnostics.rs` covers six); `--require-folded-field`, which Measure passes on the head side (`MCP_REQUIRE_FOLDED_FIELD` in `measure.yml` and `tools/ci/measure-reference-models.sh`), makes diagnostics without the field a difference. Without it (the base side) the old reconciliation is used. - Docs: `docs/export-diagnostics.md`, `docs/schemas/export-diagnostics.schema.json` (additive), `docs/mcp.md` (its 52 placeholder-named rows are of the office's 12,974 as built, 52 of 13,020 at permit: counted in run 41986491801's dump), a dated note in `reports/element-framing/RE-337-wall-ends-at-the-base-wall.md` where it quotes `parameter_value_count` (54,952 and 55,145), the fragment `changelog.d/fixed/1424-diagnostics-count-written-elements.md` with its Upgrading note, and the follow-up wording of the 1327, 1417 and 1422 fragments. - Read and left unchanged: `viewer/tests/journey.spec.ts` (its schedule-per-type and row-total comparisons hold on a model with folded pieces now that the CSV and the counts both follow the writer), rvt-py and rvt-wasm (no field of these is named), `tests/fixtures/project-counts/` (Core Interior, Einhoven and RE1 have no folded piece, none moves), `tools/ci/validate-real-ifc.py`, the witness payload. - The `actionlint` complaint at `measure.yml:729` (`uses: $/.github/actions/fetch-corpus`) is on a line this PR does not touch. ## Testing - [ ] `tools/check-local.sh`: not run (no local builds in this checkout); CI is the gate. `cargo fmt --all -- --check`, `python3 -m py_compile`, `shellcheck` on the driver and `python3 tools/release/changelog.py check` pass here. - [ ] Measure run 41986491801 (`base=main`, `nordic`, `r2025`, `holdout`; code head f7da923, before the gap-item, `Pset_`, `export_gltf` and scorer changes), read: `ifc.sha256` equal on 53 of 53 models. Diagnostics compared on 35 models: only the two office files moved, each by 47 in `building_elements` (13,021 to 12,974 as built; 13,067 to 13,020 at permit), `building_elements_with_geometry` (12,787 to 12,740; 12,833 to 12,786), `by_ifc_type.IFCCOVERING` (158 to 111; 122 to 75) and the sum of `body_sources` (its key `partition_element_record_bbox`); `body_pieces_folded` is `{"IFCCOVERING": 47}` on both and empty on the other 33. `bounding_box_bodies` (10,723; 10,844), `storey_bound_elements`, `parameter_value_count` (54,952; 55,145) and the `skipped` items are unchanged there. The MCP scorer reads PASS (0 differ) on all 53 models of the head side, with one more comparison in its counts check there than on the base side (the old reconciliation); the diff of every scorer output between the sides is that "compared" integer on 53 files and nothing else. - [x] Final run: Measure run 41989882391 (`base=main` a4044dc, `nordic`, `r2025`, `holdout`; code head 0b1bc04, the later commits change the contract and docs only), read: - `ifc.sha256` identical on all 53 models. - Diagnostics (35 models keep them; the held-out ones keep counts only) move on exactly the two office files. As built: `building_elements` 13,021 to 12,974, `building_elements_with_geometry` 12,787 to 12,740, `by_ifc_type.IFCCOVERING` 158 to 111, `decoded.parameter_value_count` 54,952 to 54,764. At permit: 13,067 to 13,020, 12,833 to 12,786, 122 to 75, 55,145 to 54,957. `body_pieces_folded` is `{"IFCCOVERING": 47}` on both and empty on the other 33. `body_sources` moves by 47 in `partition_element_record_bbox` on both; `skipped`, `storey_bound_elements` and `bounding_box_bodies` do not move. - MCP scorer, head side (`--require-folded-field` set, `MCP_REQUIRE_FOLDED_FIELD` is 1 in the job): every consistency check reads 0 differ and PASS on all 53 models, and the new "parameter values" check (`parameter_value_count` equals the `Pset_` values in the IFC) passes on every model. Base side (main's build, flag unset): that check differs on exactly the two office files, the IFC holding 54,764 and 54,957 values where main's diagnostics count 54,952 and 55,145. So that equality had not been checked on these files before. - Not measured: the held-out models' diagnostics (counts only), Autodesk's samples, the `export_gltf` note on a model with folded pieces, and the exclusion of a box-sourced folded piece (below). - [ ] The IFC is unchanged by design (the writer is untouched); the witness payload is Core Interior's, which has no folded piece. - Unmeasured on every model: the exclusion of a folded piece from `bounding_box_bodies`, the refusal maps and `body_is_record_box`. The office's pieces carry `BodySource` `partition_element_record_bbox` with a resolved plan profile (a sketch ceiling), so they are not box bodies and `bounding_box_bodies` did not move; no measured model has a box-sourced folded piece. ## Audit-honesty checklist - [x] Docs reflect the change; no figure is cited from a run that predates the rule it is evidence for (the before-figures cite run 41977947391, the first-round figures run 41986491801 with its head) - [x] Fragment under `changelog.d/fixed/` - [x] No emojis, no private paths ## Breaking changes A reader of `exported.building_elements` or `by_ifc_type` sees fewer on a file with folded pieces (47 fewer `IFCCOVERING` on each office file); add `exported.body_pieces_folded` to get those two figures from before. `body_sources`, the geometry-gap `skipped` items and `decoded.parameter_value_count` change likewise and are not recoverable from it. The new field is additive (`serde(default)`, absent in older sidecars). ## Related issues Closes #1424
DrunkOnJava
added a commit
that referenced
this pull request
Nov 5, 2026
… folded piece (#1422) (#1431) ## Summary A click in the viewer now picks what is drawn. A raycast does not look at `visible`, so with a category hidden, a click on what is drawn behind it selected the hidden element. `viewer/tests/folded-pieces.spec.ts` is the first browser test of a piece folded into another element's body: on the BIM4LCA office as built it hides every category but the folded pieces' one, and clicks until a click lands on a folded piece, read from the raycast's own hit. The panel's ElementId, Name and GlobalId and the selected tree row are the owner's, the panel has no Extents group, the IfcCovering category count is the 111 the tree lists rather than the 158 meshes drawn, and the schedule total is the elements the export writes. ## Motivation #1422 and #1423 changed how a click on a folded piece resolves, and no browser test could reach it: none of the models the browser tests hold has a folded piece. The probe of #1423 proves the Rust side only. Writing this test turned up the pick bug, which applies to every model. ## Changes - `viewer/src/main.ts`: `pickEntity` takes the first hit that is drawn (`isDrawn`, which walks the parents). A category hidden before the meshes arrived now stays hidden: the toggle only ever reached the meshes the scene already had (`applyCategoryVisibility` once the model is in). - `viewer/tests/folded-pieces.spec.ts`: the test. It records the worker's model and scene and the raycast's hits, and every click is a real pointer event. It needs `RVT_VIEWER_OFFICE` and is skipped without it. While it scans for a click on a piece it holds back the worker's panel requests, because each one queues a whole-model decode (a first version took 11.9 minutes in CI); that is the one thing it changes in the page, it is released before the click that is asserted, and that click is made again at the same point with a hidden element in front of what it selects. It checks the panel, the GlobalId against the model, the tree row, that no size is stated, the category and schedule counts of the written elements, and that a stair flight shows its stair's storey. - `.github/workflows/viewer-test.yml`: browser tests 1/3 and Deploy viewer's leg (so the release wasm too) run it, on a copy of the office as built restored from the cache or fetched by byte range, checked against the pin in `research/bim4lca-measure.tsv`. Only `main` saves that cache, and only a file that was verified. An unreachable host, or a fetch over 240 s, reports NOT MEASURED and skips the test; a file that no longer matches its pin fails. - A changelog fragment. ## Testing Unit tests are banned; this is end to end. - **On the deployed viewer** (`main` at a4044dc, system Chrome, headless), run locally against the pinned file: pass in 58.7 s. Click 373 of the scan landed on folded piece 13807 of ceiling 2105195, and the panel was the ceiling's; 19 owners, 47 folded pieces, IfcCovering 111 listed. **That build does not have the pick fix**, so that run dropped hidden hits inside its own capture to reach the piece, and says nothing about the fix. It also predates the schedule total check. - **On this branch**, CI's browser tests run the committed spec on this pull request's own build, without that workaround, and require at least one click with a hidden element in front of what it selected. The first version passed in CI at 623ee59 (`office: 19 owners, 47 folded pieces, 12974 written; IFCCOVERING 111 listed; ... 13 clicks had a hidden element`, 11.9 minutes). On the final head ef66150 it passes in 4.4 minutes, inside a leg of about 7: `office: 19 owners, 47 folded pieces, 12974 written; IFCCOVERING 111 listed; click 2 hit piece 13762 of 2103288, 2 clicks had a hidden element in front`. Browser tests 1/3 reads 10 passed, 6 skipped. That includes the stair flight's storey and the re-click with a hidden element in front. Not exercised: a body piece with a solid or saved mesh that stays its own element (`writtenElementOf` for a listed piece). No model the test opens has one reachable this way, so that path is checked by reading only. - [x] IFC exporter untouched: viewer TypeScript, one test and one workflow only. ## Audit-honesty checklist - [x] A changelog fragment under `changelog.d/fixed/`. - [x] No emojis, private paths or personal addresses in committed files. The office is CC BY-SA 4.0, already fetched and cached by Measure, and never committed. ## Legal and contribution hygiene - [x] Apache-2.0. No Autodesk proprietary source, decompiled internals or NDA content. ## Breaking changes None. ## Related issues Closes #1422: the panels (#1423), `docs/viewer-api.md`, and now the office in a real browser; Einhoven's Playwright pins are checked by this PR's CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The viewer's Schedule panel (
build_schedule), element info panel (element_info_panel) and scene tree (build_scene_graph) put each element on the storey the IFC export writes it in and list only the elements it writes, as the MCP server (#1412), the rooms schedule and the elements CSV (#1421) do. A part of a stair (a run, landing or stringer) or of a curtain wall is on the storey of its whole, an element in a room on the storey of the room, an opening on the storey of its host, and a further piece of an element of separate loops that the export folds into the owner's body is neither a schedule row nor a tree node. The panel of an element with folded pieces states no size, as its CSV row has no size cells, and a click on any loop of such an element selects the element.Motivation
#1412 made the writer's placement decision public (
step_writer::placements,storey_of). The viewer's three scene-graph functions still took a level from the element's ownstorey_indexand listed the folded pieces, while the "Download element schedule (CSV)" button in the same viewer gives the written placement (#1417, PR #1421). Refs #1422.Changes
src/ifc/scene_graph.rs:build_scheduleskips an index whose placement isFoldedand takes the row's storey, and so its sort key, fromstorey_of(&placements(model), idx).element_info_paneltakesstorey_name,storey_elevation_feetandstoreyfromstorey_of, and leaves a folded piece out ofhosted. For an element with folded pieces (model.body_pieces, a piecePlacement::Folded, fix(ifc): the elements CSV lists each element on the storey the IFC writes it in (#1417) #1421's condition) it leaves out the size rows and the Profile row, and does not listextentsas missing. A folded piece is still drawn by the glTF export, so a click in the 3-D view can pick it: its panel is the one of the element that owns it. The panel has a newentity_index, additive, the index of the element it describes.build_scene_graphbuckets every element bystorey_of, not by its ownstorey_index, and gives a folded piece no node. This is the same defect as the panels (the tree groups elements by storey), so it is in this PR. A door or window is nested under its host only where the host is a written element on the same storey; otherwise it is a node of its own storey, as is one of two elements that host each other (before, an element whose host was not a building element was left out of the tree).viewer/src/main.ts: a click on a folded piece selects the element that owns it (the pick maps it locally, and the panel'sentity_indexresyncs the selection if it differs): its tree row, its GlobalId, and a highlight and zoom over the element and all its pieces (IfcModel::body_pieces). The category highlight and the storey and category framing cover the pieces of the elements they reach. The category list counts the elements the tree lists, soIfcCoveringreads as the schedule and tree do. A part of several wholes sits under the first, asaggregate_wholeshas it.model.body_pieceslists the pieces of every owner, but the export folds a piece only where the owner's body and the piece's are both plain (fold_body_pieces); a piece with a body of its own stays an element with its own tree row. SowrittenElementOfandbodyPiecesOftake the elements the scene graph lists as the written ones (aSetof its entity indices, reset wheresceneGraphis): a listed index is its own element and a listed piece is not one of its owner's, with no fold rule copied into TypeScript (6881cb5, after the measured code head a8785bb).docs/viewer-api.md,docs/viewer-build-pipeline.md,docs/user-guide.md,docs/status.mdand the doc ofbuildScheduleinrvt-wasm/src/lib.rs: what the storey is, what the tree and the schedule list, the panel'sentity_indexand size rows.changelog.d/fixed/1422-viewer-panels-written-placement.md.probes/examples/probe_1422_viewer_panel_levels.rs: builds the model the viewer's wasm binding builds (ExportOptions::default()), reproduces main's rules inline, and counts against what the three functions return now: the schedule rows removed, the elements whose storey moves in the schedule, the tree and a sample of panels (all that move up to 2000, up to 300 folded pieces, up to 300 elements with folded pieces, an even spread of 300), by IFC type and by why; it checks the schedule rows and the tree nodes are exactly the written elements on the placements' storey, in level-elevation order, every sampled panel's storey,entity_indexand size rows, and counts the panels whose size rows are left out. Its checks derive fromplacements, so they prove the plumbing; the independent evidence for the decision is the MCP scorer reading the written IFC (consistency element storeys, 0 differ on 53 models, run 41977947391).src/ifc/schedule_csv.rs(fix(ifc): the elements CSV lists each element on the storey the IFC writes it in (#1417) #1421);exported.by_ifc_typeandbuilding_elementsin the diagnostics still count the folded pieces (Diagnostics count pieces folded into another element's body as exported elements (47 extra IfcCovering on the BIM4LCA office) #1424), so the Schedule panel's total can read 47 below the diagnostics' on the office until that lands.Testing
Unit tests are banned: none added. Proof is the probe and Measure. The viewer's browser tests run in CI as part of
CI passed.Measured at code head a8785bb (the head the runs were dispatched on). Two commits came after it: a merge of main 182ed21, which holds #1421, with edits to the changelog fragments only, and 6881cb5, which changes
viewer/src/main.tsonly (below). The Rust, the IFC identity run and the probe figures are those of a8785bb:base=none,scorers=none,nordic=true,r2025=true; the office as built and at permit, Einhoven,r2025-13*tor2025-17*): all 8 models pass all 10 checks,panel-entity-indexandpanel-extentsincluded. Einhoven: 37 elements, nothing moved or removed (a null result). Office as built: schedule 13,021 to 12,974 rows, 47IfcCoveringremoved; 599 move (57 none to a storey, 542 storey to storey:IfcMember542,IfcStairFlight35,IfcSlab22, all parts of a whole); the tree and the panels move the same 599; the tree'sUnassignedstorey goes from 60 to 3; the panels of 19 of 19 elements with folded pieces have their size rows left out. At permit: 13,067 to 13,020, the same moves,Unassigned59 to 2, size rows left out on 20 of 20.r2025-13tor2025-15: 3 move (none to a storey),Unassigned3 to 0;r2025-16andr2025-17: 1 moves,Unassigned1 to 0. Einhoven and the Revit 2025 models have no element with folded pieces (0 of 0), so they are a null result on the size rows. The moved counts are the same as in run 41983448919 at 32f8a3e, read from both runs'probe.txt.base=main,scorers=none):ifc.sha256equal on 8 of 8 models.These figures cover the Rust side: what the three functions return and the panel's
entity_indexand extents. The probe did not count elements that host each other, so that path is not known to be exercised.Not measured: the viewer's TypeScript (the click selecting the written element and the resync to
entity_index, the highlight and zoom over the pieces, the category counts, the part under the first whole) in a real browser, since no browser test exercises the fold path (Einhoven has no folded piece); the held-out models and Autodesk's samples; 2024 Core Interior and RE1; the viewer's saved-mesh model beyond what the probe builds. The viewer's Playwright tests (CI) cover the Einhoven wall panel's storey jump target, the schedule's group counts adding up to its total, the CSV header and the journey test on the reference models; this PR's CI run is their first run on it.#1422's done-when: both panels read
placementsandstorey_ofand leave folded pieces out (done);docs/viewer-api.mdsays what the level is (done); the office and Einhoven are checked, but by the probe, which builds the viewer's model and calls the functions the wasm binding calls, not in a browser, and the Playwright pins have not run on this head yet. So this isRefs, notCloses.Audit-honesty checklist
docs/viewer-api.mdsays what the storey is, which elements the schedule, tree and panel list, and what the panel'sentity_indexand size rows are.changelog.d/fixed/, not inCHANGELOG.md.by_ifc_typeandbuilding_elementscount the folded pieces (Diagnostics count pieces folded into another element's body as exported elements (47 extra IfcCovering on the BIM4LCA office) #1424); the held-out models and Autodesk's samples are not measured.Legal and contribution hygiene
Breaking changes
For users of
rvt::ifc::scene_graphand the wasm bindingsbuildSchedule,elementInfoPanelandbuildSceneGraph: a schedule row or tree node can be absent that was listed before (a piece the export folds into another element's body), an element's storey can differ from before (a part, an element in a room or an opening has the storey of its whole, room or host), a hosted element can be a node of its own storey where it was nested under a host on another one, andelement_info_panel(idx)for a folded piece returns the panel of its owner (the owner'sname, the same ElementId) where it returned the piece's own. The panel of an element with folded pieces has no extent rows.ElementInfoPanelgainsentity_index(additive;#[serde(default)]). The public API does not change otherwise.Related issues
Refs #1422