Skip to content

fix(re): the scorers place Revit's IfcSite in the file's length unit - #1353

Merged
DrunkOnJava merged 1 commit into
mainfrom
fix/scorers-site-unit
Nov 4, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
fix/scorers-site-unit

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

tools/re/ifc_common.py::site_frame moved Revit's meshes into rvt-rs's internal feet by subtracting the IfcSite's origin from the IfcOpenShell world, which is in metres. It read the origin in the file's length unit and did not scale it. For a Revit export in millimetres with a placed site, Revit's side of every comparison was off by about 1000 times the site's offset. It now scales the origin by the file's unit. A file in metres, or placed at the origin, is unchanged.

Motivation

Found while scoring a public Revit 2021 export in millimetres for #1261 (RE-330). wall_layers_vs_ifc.py had the same defect and was fixed on its own in RE-126; this is the shared copy the other scorers use.

Changes

  • tools/re/ifc_common.py: site_frame scales the site's origin by ifcopenshell.util.unit.calculate_unit_scale.
  • docs/rooms.md: the two rows and the sentences that quoted the corrected counts.
  • reports/element-framing/RE-313-space-outlines-measured.md, RE-314-room-outlines-2026-2027.md: a dated correction after the figure each quotes (their history is not rewritten).

Testing

Unit tests are banned here: none added. The evidence is a pair of filtered Measure runs that export the same rvt-rs commit (-f ref=35a9d322, #1351's head) and differ only in the scorers they run, -f base=none -f nordic=true -f holdout=true -f models="nordic-office-* holdout-*" -f scorers=space_profiles_vs_ifc: with the fixed scorers (41833543727, --ref feat/1261-area-boundaries, where this change first stood) and with main's (41833547378, --ref main). Of the 22 models, 20 have identical space counts (the four office files, Warmond, Frigento, Vitoria, BIM Whale, modelo_bim, teste_export_2025 and the 2022 to 2027 pairs). Two differ, counts only:

held-out model in both area within 0.1% outline within 0.01 ft boundary within 0.01 ft
the 2026 house, main → fixed 12 → 13 10 → 13 0 → 13 0 → 13
Gdynia (2021), main → fixed 18 → 18 18 → 18 0 → 16 0 → 18

So rvt-rs's room outlines on those two models were right, and the scorer misplaced Revit's site. Measure takes scorers from --ref, so no unfiltered run is made here: the isolation pair is the evidence.

Not isolated: about 20 other scorers import site_frame (stairs, openings, tapered walls, saved meshes, ...). Only space_profiles_vs_ifc was run on the two models, so their lines for these two exports, and any figure quoted from them, may move too. A grep of docs/ and reports/ for the house's and Gdynia's space profiles found the figures corrected here; other scorers' figures for those two models were not looked for.

Audit-honesty checklist

  • Docs and the two reports state the corrected counts; no emojis; no private paths
  • Not a user-visible change: no changelog fragment
  • Held-out data: counts only, no ids or names of rooms

Legal and contribution hygiene

  • Apache-2.0; no Autodesk source

Breaking changes

None.

Every model and every scorer (added by the maintainer session)

Runs: Measure 41836847517 (--ref fix/scorers-site-unit) and 41836862051 (--ref main). Both scored main at 5afb95c, the same code, on every reference model, the BIM4LCA office files, the R2025 models and the held-out models, with every scorer.

Result: of all the scorer outputs, only the two held-out models' counts.txt differ, counts only.

  • 2026 house:
    • space profiles as in the table above;
    • space overlaps: rooms within 0.1% of Revit's face area go from 10 to 13 of 13 (upward, downward and every face);
    • mesh bodies: its 2 IfcWindow saved meshes go from 0 to 2 of 2 within 0.01 ft, within 0.001 ft and for "ref on ours".
  • Gdynia: space profiles only, as above.

Docs: no doc or report quotes the house's window or overlap figures. RE-126 records the same class of bug, already fixed, in wall_layers_vs_ifc.py::site_to_internal.

@DrunkOnJava
DrunkOnJava merged commit 9b9c677 into main Nov 4, 2026
37 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/scorers-site-unit branch November 4, 2026 13:31
DrunkOnJava added a commit that referenced this pull request Nov 4, 2026
…drawn to their joins, and a line off the axes refuses only the Areas it touches (#1261) (RE-330) (#1351)

## Summary

An Area of a Revit 2015 to 2024 file is now drawn from its area boundary
lines joined as their records say, and a line that is not along a plan
axis refuses only the Areas whose region it touches, not every Area of
its scheme on its Level. Autodesk's `rac_advanced`: 16 of its 25 Areas
are drawn on every save but 2021's (3 before), 10 of them
`area_boundary_joined` and 6 `area_boundary` (measured on every save,
run 41840118424).

**What the check rests on** (Griffin's "ship, labelled"):
- the only external check is **an IFC2X3 export from the three.js
repository, by a build of Revit 2021's exporter whose string ends "IU
alternativa 21.0.0.383" (publisher not established), showing the 2015 to
2020 state**; the 2020 save's 16 drawn Areas are within 0.1% in area and
0.01 ft in outline of it, none is written that it lacks;
- **that agreement is in-sample**: the joins were read off this same
export, and that a reference list means a join is inferred from the fit;
- the 2022 and 2023 saves are also checked against the 2024 save's
reader (the pair probe, run 41840127226), which is an agreement between
two readings, not an external check;
- **no Revit IFC4 export of these Areas exists**;
- that export is never used to remove a value or to settle a
disagreement between exporters;
- BIM Whale is byte-identical to `main` because it draws no Area body
(RE-324 §7, §8), so its 0 extras are **vacuous for the joins**.

The file's terms are **not known**: the repository is MIT, the file
carries no licence of its own that could be found, and Autodesk's terms
for the sample it exports were not checked. No workflow fetches it; it
is scored by hand from a pinned URL (RE-330 §1, §8).

**The 2024 save moves too.** 13 of its Areas are new, numbers 9 and 11
to 22: they gain a body (3 before, 16 now; RE-317's reader drew 23, 24
and 25, still `area_boundary`), and the other 9 keep their refusal. The
same 13 are new `IfcSpace` on the 2015 to 2020, 2022 and 2023 saves (94
to 107). `SpaceOutlineSource` is `area_boundary_joined` for 9, 12, 14,
16, 17, 18, 19, 20, 21 and 22 and `area_boundary` for 11, 13 and 15 (the
Python version of the rule; the kept IFC of run 41840118424 has the same
split on each save). Their evidence: the pair probe, where the 2022 and
2023 saves equal the 2024 save, and the IFC2X3 export of the 2015 to
2020 state; nothing else.

## Motivation

#1261: "Areas bounded partly by walls" and "boundary lines that are not
along the plan axes". RE-330 shows that the 4 Areas called bounded
partly by walls are bounded by lines alone: the lines stop short of the
lines they join, and the export carries them on. No wall bounds any Area
drawn. Of the four lines whose box is not a line along an axis, one is a
straight line off the axes (178310, Areas 7 and 8), two are axis lines
whose record box is 0.497 ft wider than the line (177377 and 177363,
Areas 1 to 5) and one is an arc (178788, Area 10); Area 6 has a join its
records do not name. Reading Areas bounded by those is the next step,
and the probe holds their stored ends.

## Changes

- `src/research/partition_area_boundaries.rs`: `Arrangement::new` takes
each line's named ElementIds. A free end is carried on to the farthest
perpendicular line within 1 ft that names it and is named by it, **only
if that line, after its own carry, spans the place reached** (else the
end stays free); the free ends of two parallel lines within 1 ft that
name each other, stop at the same place and run away on opposite sides
are joined by a connector, a flag on the segment rather than the id
`u32::MAX`. `AreaFace.joined`, `Arrangement::reads`. The stored ends of
a line are nodes, so an edge lies wholly on the stored extent or wholly
past it.
- `src/research/partition_area_records.rs`: a line off the axes is left
out of the group's arrangement with its box (and the readable lines that
name it); an Area whose region's box comes within `UNREAD_MARGIN_FEET`
of such a box is refused `boundary_lines_not_readable`. `LineRecord`
equality includes the reference list. `m_area_body_joined`.
- `src/ifc/export_content.rs`: `SPACE_OUTLINE_AREA_BOUNDARY_JOINED`;
`contain_in_spaces` leaves both out of the spaces that hold furniture.
- `rvt-mcp/src/schema.rs`, `server.rs`, `docs/mcp-tools.json`,
`docs/mcp-tools.md` (regenerated by `tools/ci/render-mcp-tools.py` after
the merge with #1350), `docs/mcp.md`: the `space_outline_source`
descriptions name the new value.
- `probes/examples/probe_re330_area_line_curves.rs`,
`tools/re/area_joins_vs_ifc.py` (the same rule and caps in Python),
`tools/re/space_profiles_vs_ifc.py` (the new value counts as an Area),
`reports/element-framing/RE-330-area-joins.md`, `docs/rooms.md`,
`docs/status.md`, `docs/evidence.md`, `docs/supported-profile.md`,
`docs/export-diagnostics.md`, `docs/support-matrix.json`,
`changelog.d/changed/1261-area-joins.md`.
- The scorer fix for millimetre exports is #1353 (merged).

## Testing

Unit tests are banned in this repository: none added.

- [ ] `tools/check-local.sh` passes (CI is the build here; fmt is
checked, the Rust has not been compiled locally)
- [ ] Verified end to end on real Revit files: see RE-330 sections 4 and
7
- [ ] The witness verdicts replay: the office's IFC must stay byte for
byte `main`'s

Runs (Measure, `--ref main`, filtered). At `35a9d322` and `cf8d807d`:
read in RE-330 §4 and §7. At `dc56e83b` (the stored ends as nodes), all
green, read: every `rac_advanced` save of 2015 to 2020 and 2022 to 2024
has 10 `area_boundary_joined` and 6 `area_boundary` (41840118424), the
2021 save none; office 41840110952 and BIM Whale 41840122975 byte for
byte `main`'s; of 43 samples (41840114594) only those nine saves move;
the pair probe 41840127226.

At `a883a238` (the carry checks its target, caps of 1 ft, connectors on
opposite sides, the label, the wording of RE-330 §5), **not yet read**:
office 41843487977; samples against `main` 41843493504; all samples 2015
to 2024 with the IFC kept 41843497745; BIM Whale 41843502531. They are
to show the same 16 per save (10 and 6), the office and BIM Whale
unchanged, and the same nine saves moving.

## Audit-honesty checklist

- [x] Docs, support matrix, changelog fragment and report say what the
check rests on, that it is in-sample, and that no Revit IFC4 export of
these Areas exists
- [x] A user-visible change has its fragment under
`changelog.d/changed/`
- [x] Known limitations documented: 9 Areas of `rac_advanced` are not
written (RE-330 §5); the 2021 save is still refused; the export's
licence is unknown; farthest-over-nearest, the opposite-sides condition
and the caps are unmeasured where they would decide
- [x] No emojis, no private paths

## Legal and contribution hygiene

- [x] Apache-2.0; no Autodesk source or SDK content: the check is a
public output of Autodesk's sample project (three.js at commit 7c1f4773,
sha256 pinned in RE-330 §8), fetched by hand and never stored in the
repository; `revit-ifc` is read for what it writes only (CLEANROOM.md
source 5), not copied.

## Breaking changes

None. `Arrangement::new` gains a parameter and `AreaFace` a field
(research API, `unstable-research`).
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