Repository navigation
feat(elements): decode a door's and window's hand flip and facing flip from the native record (#1357) (RE-343) - #1438
Merged
Merged
Conversation
DrunkOnJava
marked this pull request as ready for review
November 5, 2026 12:59
DrunkOnJava
enabled auto-merge (squash)
November 5, 2026 15:50
# Conflicts: # docs/format-reconnaissance.md
This was referenced Nov 5, 2026
DrunkOnJava
added a commit
to puzzbobb/rvt-rs
that referenced
this pull request
Nov 5, 2026
…345 being taken (DrunkOnJava#1190) (RE-346) RE-343 is DrunkOnJava#1438's door and window flips, RE-344 is DrunkOnJava#1442's parameter ids and RE-345 is DrunkOnJava#1452's Revit 2025 beams. The report, the readers' doc comments, the scorers, the docs and the changelog fragment cite RE-346. Refs DrunkOnJava#1190
8 of 9 tasks
DrunkOnJava
added a commit
that referenced
this pull request
Nov 5, 2026
… plan topology alone, marked unchecked (#1434) (RE-333) (#1450) ## Summary Closes #1434. May the plan topology draw an Area when the partition copies of its lines conflict? **Yes, for a conflict that stays in place, and for nothing else.** The 2021 save of Autodesk's `rac_advanced`, which holds both states of the model (16 lines with two copies that differ in box by 0.0246 ft, each naming the same Level and scheme at the same height), now writes its 25 Areas, from the plan topology alone. They say `SpaceOutlineSource` `area_plan_topology_unchecked`, and a gate holds the 2021 save to the 2022 save. **The rule.** A line whose copies disagree but share their Level, scheme and height can lie in one group only. That group is `Group::Conflicted`, no longer `Unreadable`: the lines' arrangement is not read (which copy is current is not known from the partitions), and the topology, which reads the current copy of each line and is checked against the area Revit saves for the loop and the Area's point, draws it. An Area may name such a line; the lines it names must still bound its region. A copy that names another Level or scheme or lies at another height, a design option, a stray height, a missing line and a line off the Level still make the group unreadable. Where the topology is not read, the Area keeps `boundary_lines_not_readable`. **The evidence** (RE-333 section 10): - The 2021 save's topology regions equal the 2022 save's, 25 of 25 (vertex count, holes, arcs, area), and differ from the 2020 save's on exactly the 7 Areas where the 2020 and 2022 saves differ (0.23 to 2.77 ft2). The native current copy of the 2021 save is the later state. - Measure run 42054772905 (unfiltered, `-f base=main -f nordic=true -f r2025=true -f samples=true -f racadv=true -f holdout=true`, no `ifc_flags`, head 240989f with main at dd3dc11 merged): green, `Same-project gates` green. **One model of 117 exports moves, the 2021 `rac_advanced`**; the other 116 are byte for byte main's. Of the 93 models with public diagnostics it is the only one with a group-level refusal on main (22 `boundary_lines_not_readable`, 3 `named_lines_not_in_scheme_and_level`, now 0). It writes 25 Areas with a body, 25 `native_area_plan_topology`; 25 more property sets and swept solids. Run 42030399700 on 9b5f0bc (before the marker below) gave the same counts. - **Exercised: 1 model, 25 Areas.** The 24 models whose diagnostics are kept as counts only (held-out and other unlicensed) do not move, so none exercises the change. The held-out Revit 2021 Areas model is 6 in both files, 0 only in rvt-rs's, 2 only in Revit's, as on main: `only in rvt-rs` 0 holds and says nothing about this change. - **No public file has a design-option area line**, so that refusal (and the stray height, missing line, off-level line and moved copy) is kept by construction and shown only by failure-first tests of the pure helpers `group_arrangement` and `same_place` on synthetic data, not on a Revit file. - The gate, `tools/re/areas_across_saves.py 2022=... 2021=...`, in the shard that holds both saves: 25 compared, every field equal on 25 (GlobalId, number, name, storey, outline source, body area, top surface, height, lowest vertex), none missing or extra. The 2024 to 2027 gate still passes. `tools/ci/same_project_verdict.py` requires the 2021 gate when the run's sample years hold both saves (so `sample_years="2024 2027"` does not need it) and fails on a result that fails whether or not it was required; checked on the shards of run 42054772905 (success with and without the 2021 gate required) and by its tests. **The marker (Griffin's decision, AskUserQuestion, 2026-11-05).** The 2021 save's Areas say `area_plan_topology_unchecked`. Their outlines are the later state of the model; the only Revit export of the project shows the earlier state, which equals 18 of the 25 and does not show the other 7. His marker rule of the same day is by release (2025 to 2027 unchecked, 2015 to 2024 `area_plan_topology`), so the 2022, 2023 and 2024 saves, the same later state, keep `area_plan_topology`; this save's Areas are his separate decision, made in `partition_area_records::area_unchecked` beside the release rule. Every `IfcSpace` carries `SpaceKind` (the new Areas say `area`). **Changes** - `src/research/partition_area_records.rs`: `Group::Conflicted`, `BoundaryLines::moved`, `same_place` (it tests the Level, the scheme and the height, not the box), the topology-only path in `locate`, the named-line rule in `draw_area`, `area_unchecked`; 15 pure-helper tests. - `src/ifc/export_content.rs`, `rvt-mcp/src/schema.rs`, `docs/mcp-tools.json`, `docs/mcp-tools.md`, `docs/mcp.md`: the unchecked value's description. **The MCP contract changes**; the JSON is edited to the text the server writes and the markdown re-rendered with `render-mcp-tools.py`, so CI's `tool_contract_is_committed` is the check. - `tools/ci/measure-reference-models.sh`, `tools/ci/check-areas-across-saves.sh`, `tools/ci/same_project_verdict.py` and its tests, `.github/workflows/measure.yml`, `tools/re/areas_across_saves.py`: the second gate. - `reports/element-framing/RE-333-area-plan-topology.md` section 10; the Area paragraphs of `docs/rooms.md`, `docs/status.md`, `docs/evidence.md`, `docs/supported-profile.md`, `docs/support-matrix.json`, `docs/export-diagnostics.md`; `changelog.d/added/1434-areas-2021-save.md`. ## Testing Unit tests are banned except for pure helpers: the tests added are failure-first tests of `group_arrangement` and `same_place`, which read no file. The gate's outline-source field, not a test, checks the marker. - [x] Measure 42054772905 (unfiltered; see above) and 42030399700. - [x] `python3 tools/release/changelog.py check`, `python3 tools/ci/api-doc-ids.py`, `python3 tools/ci/test_same_project_verdict.py` (30 tests), `rustfmt --check` and `bash -n` of the scripts pass locally; no local build, per this checkout's rules, so CI compiles and runs the Rust tests. - [ ] A samples-only run (`-f samples=true -f scorers=bodies_across_saves`) on the final head, after #1452 lands and main is merged, to write the `same-project gates` check run. - **No unfiltered rerun.** The `src/` Area code is unchanged since run 42054772905: the later commits touch `src/` only in doc comments, the two removed tests and main's merge (door flips #1438, saved graphics #1441, none in the Area code). The gate scripts changed after it (the verdict, the summary, the notice), so a samples-only run on the final head writes the `same-project gates` check run; run 42089276000 on c912325 was green and is superseded by it. ## Audit-honesty checklist - [x] The report says what is and is not measured: no Revit export of the later state of the project; the design-option refusal is not exercised by any public file; the held-out models do not exercise the change. - [x] A changelog fragment, not `CHANGELOG.md`. - [x] No emojis, no private paths. ## Legal and contribution hygiene - [x] Apache-2.0. - [x] No Autodesk proprietary source; the corpora are fetched, not stored (CLEANROOM.md). - [x] No new fixtures. ## Breaking changes None to the API. The MCP `space_outline_source` description of `area_plan_topology_unchecked` widens (see above), and a file whose Areas main did not write now writes them. ## Related issues Closes #1434. Refs #1261.
DrunkOnJava
added a commit
that referenced
this pull request
Nov 5, 2026
…axes, its X the stored one reversed where the flips differ (#1447) (RE-347) (#1456) ## Summary Measures what rvt-rs writes for the local axes of doors and windows against Revit's (#1447, RE-347), and writes Revit's axes for those set in a plain wall. Before (Measure [42066757105](https://github.com/DrunkOnJava/rvt-rs/actions/runs/42066757105)): rvt-rs wrote the default axes on every door and window. Revit's were the same on 115 of the 521 doors and 226 of the 540 windows it binds to a plain wall in the open models (Core Interior, RE1 Architecture, the BIM4LCA office as built and at permit; the same elements as RE-343's Rule 1), and differed on 406 doors and 314 windows. rvt-rs writes no `OperationType`, so the placement's +Y is the only statement in the file of which way a door faces. The rule (RE-343 Rule 1): for a door or window set in a plain wall (its host a non-curtain wall whose native record gives a straight level line the stored X runs along, |cos| at least 0.999), the placement's X and Y are the stored axes, both reversed where `m_hand_flipped` differs from `m_facing_flipped`; Z stays up; the origin is unchanged. Doors bound to none, elements with no stored transform (Revit 2023 and older) and instances that already take the turned box (RE-87; 0 of the 27 turned plain-walled instances in the 2024 to 2027 samples have unequal flips) keep what they write today. **After, on head `c1a2a739` (Measure [42106711251](https://github.com/DrunkOnJava/rvt-rs/actions/runs/42106711251), unfiltered, `base=main`, probe, `samples` 2024 to 2027, every job succeeded):** - The rule is written for 1,061 of 1,061 bound doors and windows in the open models, all 24 doors and windows of the R2025 models and 145 of 146 in the held-out models of 2024 to 2027 (counts only), and differs from Revit's on 0. The new default scorer `door_axes_vs_ifc` (no probe) says so per model; it exits 0 on all 52 models that have a Revit export. - Base against head, the only scorer outputs that differ are that scorer's, the held-out `door axes:` lines, the gate's `doors and windows` lines and the two Core Interior witness observations. Every other scorer output in the default suite is identical. - Core Interior's witness observations (both artifacts) move by `IFCDIRECTION` 1037 to 1135 and `IFCPROPERTYSINGLEVALUE` 27824 to 27962 and nothing else; they are refreshed from the run, and `witness-verdict.py` replayed with CI's arguments is PASS for both. - The semantic diff saw dumps on all 35 models that have one; on Core Interior, RE1, the office files and R2025 model 12 the only findings are `PlacementAxesSource` and `rotation_degrees` appearing on doors and windows. - Export time, base against head, one run each: open models mean 1.007, samples 0.975 to 0.991 (runners differ, so a cost under about 2 percent is not resolved). Memory was not measured. **Bodies and openings do not move:** on Core Interior, RE1 Architecture and the two office files (`tools/re/placed_bodies_vs_base.py`), as saved meshes (Measure [42092391898](https://github.com/DrunkOnJava/rvt-rs/actions/runs/42092391898)) and as record boxes (`--no-saved-meshes`, Measure [42106731054](https://github.com/DrunkOnJava/rvt-rs/actions/runs/42106731054): every door and window is an extruded rectangle, 59 and 133 sides swapped on the quarter turns), 0 bodies and 0 openings moved in world coordinates (largest vertex difference 0.000000 ft), no GlobalId, type GlobalId or host changed. **Same-project check** (`bodies_across_saves.py`, `same-project gates` success on 9 samples): 107, 79 and 65 doors and windows of `rac_advanced` (2025, 2026, 2027) and 17 each of `rac_basic` are held to the 2024 save, 66, 44, 31 and 14, 14, 14 of them off the default axes, all the same. Two buildings, each saved by three releases; `rst_basic` has none. 28 and 42 elements the 2024 save places by the rule stay on the default axes in the `rac_advanced` 2026 and 2027 saves: the host rebind of RE-245 runs on `CUT_LOOP_REVIT_VERSIONS` (2024 and 2025) only, and on 2027 14 more are set in 8 host walls with no native straight-line row (#1475). The gate holds floors per class, project and year (2025 included, from this run's counts) and a ceiling per year on those left out, which can only shrink; #1454 widens the version list and should place the 28. **The floors for 2025 changed the gate file after run V2, so the verdict is the samples-only run [42116283678](https://github.com/DrunkOnJava/rvt-rs/actions/runs/42116283678) on the merged head `5edea997`, pending.** **rme_advanced and rme_basic are not in the gate.** Each holds 107 rule-placed doors (59 with unequal flips) and their 2026 and 2027 saves are held to nothing: their pipes do not pass the gate before #1454. Whichever of #1454 and #1456 lands second adds `rme` to the `doors and windows` group in `tools/re/bodies_across_saves.py`, with floors and ceilings. ## Motivation #1447: RE-343 (#1438) measured Revit's placement axes against the stored axes and left what rvt-rs writes unmeasured. The origin, which differs from Revit's by more than 0.5 ft on almost all, is a separate finding and is not moved here (#1465). ## Changes - `src/research/partition_schema_mvp/` (`fields.rs`, `walls.rs`, `openings.rs`, the decode flow): a straight wall's native direction, and for each door and window set in such a wall the plan direction of Revit's placement X, after the host and flips are final. - `src/ifc/export_content.rs`: a door or window carrying that direction is rotated to it (a quarter turn swaps the box's two sides, so its world extents are unchanged) and says so in `RvtElementRecordGeometry.PlacementAxesSource`. Everything downstream (opening cuts, saved meshes, family extrusions, wall-cut openings) already composes the element's rotation, as for a turned instance. `rotation_deg` (elements CSV, the viewer's schedule and info panel) and `rotation_degrees` (MCP `get_element`) are now set for these elements not on +X, and on a box-bodied one `width_ft` and `depth_ft` swap on a quarter turn: width is now along the placement's X, the door's width. No test pins either column. - `tools/re/door_axes_vs_ifc.py`: probe-free, in Measure's default list, kept for held-out models by the scrub. `tools/re/door_placements_vs_ifc.py` (the probe's scorer) explains a row by flips and binding. `tools/re/placed_bodies_vs_base.py`: the world-coordinate check between two exports. `tools/re/bodies_across_saves.py`: the `doors and windows` group (it already compares placement axes and world vertices by Tag; `readers_across_saves.py` of #1454 holds readers' values). - `docs/status.md`, `docs/support-matrix.json`, `docs/maintaining.md`, `docs/user-guide.md`, `tools/ci/check-bodies-across-saves.sh`, the report `reports/element-framing/RE-347-door-window-placement-axes.md`, a `changed/` changelog fragment, RE-343's caveat now pointing at RE-347, both Core Interior witness observations and a dated note in both count fixtures. ## Testing - [ ] `tools/check-local.sh`: not run (no local builds); CI is the build. - [x] End to end on real files: the Measure runs above, the world-coordinate check on their kept IFCs, and the witness replay. The samples-only verdict run on the merged head is pending. - Held-out data is counts only. ## Audit-honesty checklist - Not measured: Snowdon Towers against Revit's export, and the memory of the added read of the stored transforms. - The 160 doors bound to none (49 inverted by `IfcDoorType`), a curved wall and a turned instance with unequal flips (none in the samples) keep what they write. ## Related issues Refs #1447 Refs #1465 Refs #1475
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
#1357 asks for a door's or window's hand flip and facing flip, or how to derive them. They are two booleans of the instance's native
FamilyInstancerecord,m_flippedXandm_flippedY. The decoded Door and Window records now carry them asm_hand_flippedandm_facing_flipped, and the typed Door view'sflip_handandflip_facingread them. No door or window is stored as a reflection, so the transform (andm_opening_facing, its Y axis) holds neither flip as such;reports/element-framing/RE-343-door-window-flips.mdgives both answers with counts.Motivation
#1357. The reporter's two questions, answered in the report from Measure runs 42014420180, 42015182768, 42021277032, 42021280392, 42021284465, and 42024103319, 42024107131, 42024111444 (the last three at
e2f8accc), and 42037268099 and 42037272808 (at18954f33) and Snowdon Towers scored locally:InstanceInfo.m_Trf.m_3x3on all 1,219 of the open models'; and on 1,820 of the 2024 to 2027 samples.m_opening_facingturns withm_flippedXonly. For a door or window set in a plain wall rvt-rs binds, Revit's own placement is the stored axes reversed where the two booleans differ, so the direction it faces (the placement's +Y) ism_opening_facingreversed there: exact on 653 doors and 626 windows (0 wrong), and on 41 doors and 105 windows of held-out models. The two office files are one building and R2025 models 12 to 17 one layout six times: counted once, 456 doors and 346 windows. The case where the booleans differ (287 doors, 286 windows; 186 and 146 counted once) is measured on three 2024 buildings, one 2025 door, one 2026 house and no 2027 element. The 160 doors rvt-rs binds to no plain wall follow the rule on 111 and not on 49 (exact inversions, uniform byIfcDoorType, which fits revit-ifc'sStyleTransform: report sections 1 and 3, not shown); nothing is claimed for them.Changes
src/research/native_symbol_cuts.rs,partition_schema_mvp/openings.rs,fields.rs,../partition_schema_mvp.rs:OPENING_FLIP_FIELDS. On 2024 and 2025 the flips are read in the passinstance_cuts_and_symbolsalready makes over the doors' and windows' records (attach_cut_loop_sizespasses it every door and window, those that are an opening alone too; the symbols it sizes are still those of the doors with a body): no pass is added.InstanceCutsis now a struct. On 2026 and 2027, and on no other release,attach_opening_flipsmakes one pass of its own (graph_classeslimited toFamilyInstance). Both take the element's one current record (native_documentallows one per channel and id).src/elements/openings.rs: the typedDoorview matchedfliphandandflipfacing, names no record carries; it now matches the new fields, and its module doc no longer promises a hinge side.probes/examples/probe_re343_door_flips.rs,tools/re/door_flips_vs_ifc.py: the probe and scorer;tools/ci/scrub-holdout-results.shkeeps the scorer's count lines for held-out models, afield ... valuesline only with values true, false, null or under 100.reports/element-framing/RE-343-door-window-flips.md, adocs/format-reconnaissance.mdaddendum,docs/status.md,docs/support-matrix.jsonandchangelog.d/added/1357-door-window-flips.md.Testing
No unit tests (banned). End to end on real files:
e2f8accc: the unfiltered Measure againstmain(run 42024095189):ifc.sha256equal on all 111 models; the timing run (42024099050), 64 files: no peak memory moves by more than 1 MiB, export time within 1.2% ofmainon the files of 2023 to 2025 and within 1.6% on those of 2026 and 2027, against 7% either way on the 33 files of 2015 to 2023 that the change does not touch.18954f33(the second review's changes): G 42037262675, a filtered byte-identity run (the two office files and the 58 samples) againstmainata0639777:ifc.sha256equal on all 60 models, no semantic finding. D'' 42037268099 and F'' 42037272808, the probe on the open models and the samples: the fields and the typed Door view equal to the booleans on 132 of 132 doors of Core Interior, 5 of 5 of RE1 Architecture, 268 of 268 of the office (as built, and at permit), 1 of 1 of R2025 model 12, and 1,588 of 1,588 doors of the 2024 to 2027 samples; none of the 1,540 doors of 2015 to 2023.mainatdd3dc116(signed; the last merge brought fix(ifc): a project whose last phase holds no room writes the rooms of the latest phase that holds any (#1359) (RE-326) #1435 and fix(ci): the same-project gates skip a run with ifc_flags (#1435) #1446, which this change does not touch). The measured code differs from what the run ate2f8acccmeasured (the second review's edits and everythingmaingained), so the unfiltered run was repeated on the merged head80a9d72c, withmainatafec5e37as its base: run 42040585454 (-f base=main -f nordic=true -f r2025=true -f holdout=true -f samples=true), read. All 15 jobs that ran succeeded (the three timing jobs are skipped by design).ifc.sha256is the same on head and base on all 111 models (the 58 samples among them), the semantic diff has no finding on its 111 folders, and the scorer diff's one line isOnly in measure-head: areas_across_saves.txt, the Areas gate's own output.Same-project gatespassed (bodies 6 of 6 samples; the 25 Areas ofrac_advancedequal on its four saves) but test beams, stairs, sketch outlines and Areas, not doors or windows: the evidence for this change is the byte identity. The run predates feat(ci): the same-project gates write their verdict as a check run on the measured commit #1448, so the PR's gates verdict is by override citing it. Since that runmainhas moved todd3dc116; this change's ownsrc/files are unchanged (git diff 18954f33 HEADover the five).Audit-honesty checklist
changelog.d/added/;docs/status.mdanddocs/support-matrix.jsonsay whatdecoded_elements()now shows.docs/format-reconnaissance.md.Legal and contribution hygiene
revit-ifc(CLEANROOM.md source 5), read for what Revit's export writes (DoorWindowInfo,FamilyInstanceExporter,PlacementSetter);ExporterIFCUtils.GetTransformForDoorOrWindowis cited by its public name only. It cites no source outside CLEANROOM.md's five: the assignment ofm_flippedXto the hand andm_flippedYto the facing rests on revit-ifc'sDoorWindowInfo(source 5), with the API names as exported symbols (source 2), and on the measurements. I have not used Autodesk SDK source, ODA SDK source, leaked internal documentation, NDA material, or decompiled internal Revit implementation code beyond public symbol exports, and I have not copied or translated code from revit-ifc.Breaking changes
None. Two fields are added to decoded Door and Window records, and the typed Door view's two fields stop being null.
Related issues
Refs #1357