Skip to content

feat(elements): draw walls as their layers, each in its material's colour (RE-53) - #359

Merged
DrunkOnJava merged 1 commit into
mainfrom
feat/wall-layers
Sep 24, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
feat/wall-layers

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

Walls are drawn as their layers, each in its material's colour, in the glTF export and the viewer (RE-53).

  • A material's data carries its shading colour and transparency.
  • A wall, floor, roof or ceiling type's data carries its compound structure: each layer's width, material, deck and function, exterior first.
  • A wall's data carries a flip flag that puts its exterior on the right or the left of its location line.

With those, rvt-gltf and the viewer draw a Revit 2024 wall as one band per layer where the layers add up to its body's thickness. All the bands select as the one wall.

Measured end to end on Snowdon Towers (local only): the GLB rvt-gltf writes, scored against the per-layer solids in Revit's own IFC4 export.

result
walls drawn in layers 883 of the 1,054 whose layers are read
layer centres within 0.001 ft of Revit's 851 of 862 comparable walls
layer centres within 0.126 ft 862 of 862. The 11 others are one soffit type whose stud layer Revit cuts back
layer colours equal to Revit's surface style colours 1,368 of 1,368

Motivation

The 3D view showed every wall as one grey block. Now a wall shows its construction: brick, sheathing, studs, gypsum, each as a band in its material's colour, where the bytes say exactly what they are. Material colours are the first step of #355.

Changes

  • src/partition_materials.rs (new): a material's object and its shading frame. It reads the colour, transparency and shininess, for 2024 and 2025.
  • src/partition_compound_structure.rs (new):
    • scan_type_layers reads a host type's layers, in both count framings;
    • scan_wall_flips reads a wall's location line, word and flip flag.
  • src/partition_schema_mvp.rs: attach_wall_layers gives each 2024 wall its exterior normal and its type's layers, with colours (m_wall_* fields). element_layers_from_fields reads them back.
  • src/ifc/mod.rs, export_content.rs: IfcModel::element_layers. The export diagnostics gain exported.layered_element_count, and its JSON schema and docs are updated.
  • src/ifc/body_geometry.rs: clip_ring_to_band and layered_extrusion_meshes cut an extruded body into bands across the exterior normal. They fail closed when the layers do not add up to the body's thickness within 0.02 ft.
  • src/ifc/gltf.rs: a layered wall becomes one node per layer, all with the wall's entityIndex. One material per layer colour; the category colour for a layer by category.
  • viewer: File status reports the walls whose layers are read under Materials. The supported-profile panel gains a 3-D view row. Its Not ready row no longer lists system type names, which RE-44 recovers.
  • fuzz/fuzz_targets/fuzz_step_writer.rs: the new IfcModel field.
  • examples/probe_re53_wall_layers.rs: counts the walls drawn in layers and why the others are not.
  • tools/re/wall_layers_vs_ifc.py: the end-to-end scorer, GLB against Revit's IFC4.
  • reports/element-framing/RE-53-wall-layers.md, a support-matrix row (partial), a reconnaissance addendum, README, status, CHANGELOG.

Testing

End to end, against real files. No unit tests were added (unit tests are no longer written for this repository).

  • Snowdon Towers, rvt sha256 33271010…e5e44a1, Revit IFC4 sha256 ecfcb04e…cbb985a:
    • rvt-gltf then tools/re/wall_layers_vs_ifc.py. The report's §6 has the commands and the full output.
    • The viewer, through the rebuilt wasm: the Materials row reads "layers and colours read for 1054 walls". Wall 735573 shows its six bands at its top edge in order, and selecting it highlights all six as one element.
  • Core Interior (315 walls, every layer by category) draws as before.
  • The 2025 and 2023 files draw no wall in layers.
  • An experiment opening location lines to 2025 had no wall whose side could be scored, so the gate stays at 2024 (report §5).
  • fmt, clippy -D warnings, rustdoc -D warnings, the existing workspace suite, the fuzz workspace check, the MSRV check, the viewer typecheck and build, and the Playwright browser suite.
  • The IFC output is unchanged. The synthetic fixtures are byte-identical.

What this does not do

Audit-honesty checklist

  • Status partial with the residuals above. Every count is measured against Revit's own export of the same model.
  • RE finding: probe, report, reconnaissance addendum, and an end-to-end scorer with its inputs' hashes.
  • No emojis, private paths or personal data.

Legal and contribution hygiene

  • Apache-2.0
  • Clean-room: byte observations of material, type and wall data, and Revit's own IFC exports as oracles.
  • Snowdon and its IFC stay local.

Breaking changes

None. IfcModel gains a #[serde(default)] field, and ExportedModelDiagnostics gains one too.

Related issues

Refs #355, #358, and #88 (layer thicknesses are now read; wiring them into IfcMaterialLayerSetUsage waits on material names), #34.


Note

Medium Risk
New binary decoding and geometry splitting affect viewer/glTF wall rendering for 2024 models, but IFC export is untouched and layered drawing fails closed when layer thicknesses do not match the body.

Overview
RE-53 decodes compound wall structure from Revit partition bytes—type layer stacks, material shading colours, and wall exterior flip—and uses it in glTF and the viewer for Revit 2024 walls, not in IFC export.

New modules partition_materials and partition_compound_structure read material appearance and host-type layers; attach_wall_layers attaches exterior normals and per-layer widths/colours to wall elements. That data lands on IfcModel::element_layers via the production export path and is surfaced as exported.layered_element_count in diagnostics and the viewer File status.

layered_extrusion_meshes slices extruded wall bodies into thickness bands (fail-closed when layer sum disagrees with body thickness within 0.02 ft). gltf.rs emits one scene node per layer with material colour, shared entityIndex for unified selection. Walls that cannot be layered still draw as a single solid.

Adds probe_re53_wall_layers, wall_layers_vs_ifc.py, and documentation/reporting updates. IFC STEP output is unchanged (no IfcMaterialLayerSet until material names are read).

Reviewed by Cursor Bugbot for commit 2c77dad. Configure here.

…lour (RE-53)

A wall, floor, roof or ceiling type's own element data carries its
compound structure: a u32 layer count framed by ff ff ff ff and a
per-release tag (or u32 k, k x 2d 00, u32 0 on 2025 floors and
ceilings), then 37-byte layers of f64 width, u64 material, u64 deck and
u32 function, exterior first. A material's object carries its shading
colour and transparency, and a wall's data carries its location line
setting and a flip flag that puts its exterior right or left of its
location line.

The glTF export (rvt-gltf, the viewer) now draws a Revit 2024 wall as
one node per layer, cut from its body across its exterior normal, in
each layer's colour, where the layers add up to the body's thickness.
Scored end to end on Snowdon Towers against Revit's IFC4 per-layer
solids: 883 walls drawn in layers, every layer centre within 0.001 ft on
851 of 862 comparable walls and within 0.126 ft on all, and 1,368 of
1,368 layer colours equal to Revit's surface styles. The IFC output is
unchanged: layer sets wait on material names (#355).

Export diagnostics gain exported.layered_element_count; the viewer's
File status reports it under Materials. tools/re/wall_layers_vs_ifc.py
is the end-to-end scorer; examples/probe_re53_wall_layers.rs counts the
walls drawn and why the others are not (#358).
@cursor

cursor Bot commented Sep 24, 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_225bc662-6c9a-47c0-9b1a-5ce910a93fea)

@DrunkOnJava
DrunkOnJava merged commit af5585d into main Sep 24, 2026
23 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/wall-layers branch September 24, 2026 01:02
DrunkOnJava added a commit that referenced this pull request Sep 24, 2026
…s thickness (RE-54) (#360)

## Summary

Revit 2024 walls are built from their centreline at their type's
thickness (RE-54).

The location line a wall's data stores (RE-49's bounded line) is its
centreline, whatever its location-line setting. Revit's IFC4 body lies
exactly half the type's layer sum (RE-53) either side of it on 964 of
Snowdon Towers' 1,054 walls.

The exporter now builds a wall from that line where the record box does
not already give it. Angled walls were drawn as their whole axis-aligned
box, and now run along their line at their real thickness.

Measured end to end on Snowdon Towers (local only): `rvt-gltf`'s GLB
against the bodies in Revit's own IFC4 export, before (#359) and after.

| | walls | within 0.001 ft before | after |
|---|---:|---:|---:|
| faces, angled | 102 | 0 | 75 |
| ends, angled | 102 | 1 | 13 |
| faces, axis-parallel | 976 | 918 | 927 |
| ends, axis-parallel | 976 | 338 | 338 |

- Per wall, taking the larger of its face and end differences: 71
better, 1,003 unchanged and 4 worse. The 4 are angled walls whose ends
run to the joint where Revit's butt joins stop short or run on.
- Walls drawn in layers: 967 (883 before). Every layer centre is within
0.001 ft of Revit's on 935 of 946 comparable walls.
- Core Interior: unchanged. Its IFC is byte-identical apart from
timestamps.

## Motivation

Angled walls were the worst geometry in the model: boxes up to 9 ft too
thick. With RE-53's type thickness and the stored centreline, every wall
has what it needs to be drawn as itself, and more walls can show their
layers (#358).

## Changes

- src/partition_compound_structure.rs: `wall_orientation` /
`scan_wall_orientations` read the location-line setting, the word after
it and the flip. They replace `wall_flip` / `scan_wall_flips`.
- src/partition_schema_mvp.rs: `attach_wall_layers` also gives each 2024
wall with word 1 its centreline and its type's thickness
(`m_wall_axis_*`, `m_wall_type_thickness`). `wall_axis_from_fields`
reads them back.
- src/ifc/export_content.rs: `wall_centreline_body`:
- An axis-parallel wall keeps RE-26's trimmed run. It keeps its box if
the box is thinner than the type, a wall Revit cut.
- An angled wall is the rectangle its box closes on (1e-4 ft) when the
box is centred on the line. Otherwise it runs joint to joint, unless the
box exceeds that rectangle's by more than 2 × max(T, 1 ft), a leaning or
profiled wall.
- The body replaces the box only where the two differ: `BodySource`
`partition_wall_centreline`, `ThicknessSource`
`wall_type_compound_structure`.
- tools/re/wall_bodies_vs_ifc.py: the end-to-end scorer.
- reports/element-framing/RE-54-wall-bodies.md, a support-matrix row
(partial), a reconnaissance addendum, README walls row, status,
CHANGELOG.

## Testing

End to end, against real files. No unit tests were added.

- Snowdon Towers, rvt sha256 `33271010…e5e44a1`, Revit IFC4
`ecfcb04e…cbb985a`:
- `rvt-gltf`, then `tools/re/wall_bodies_vs_ifc.py` and
`tools/re/wall_layers_vs_ifc.py`. The report's §3 has the commands and
output.
- rvt-rs's IFC of Snowdon, meshed by IfcOpenShell, equals its GLB on all
1,078 walls to 1e-5 ft.
- Core Interior against `IFC Exports/2024_Core_Interior_slim.ifc`: 360
of 360 faces and 351 of 360 ends within 0.001 ft, as before. The IFC
output is byte-identical apart from timestamps.
- fmt, clippy -D warnings, rustdoc -D warnings, the existing workspace
suite, and the MSRV let-chain scan.

## What this does not do

- Angled walls' ends at joints. At two-wall joints Revit butt-joins 115
of 156 end faces, which is RE-26's open wrap-or-butt question (#238).
T-junctions are not found.
- Walls Revit cuts or profiles (67 with word 1), and walls with word 0
or 2 (23), keep their box.
- Revit 2025 walls: location lines are read on 2024 only.

## Audit-honesty checklist

- [x] Status partial with the residuals above. Every count is measured
against Revit's own export of the same model.
- [x] RE finding: report, reconnaissance addendum, and an end-to-end
scorer with its inputs' hashes.
- [x] No emojis, private paths or personal data.

## Legal and contribution hygiene

- [x] Apache-2.0
- [x] Clean-room: byte observations of wall data, and Revit's own IFC
exports as oracles.
- [x] Snowdon and its IFC stay local.

## Breaking changes

`partition_compound_structure::wall_flip` / `scan_wall_flips` (added in
#359, not released) are replaced by `wall_orientation` /
`scan_wall_orientations`.

## Related issues

Refs #358, #238.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes core IFC/glTF wall body generation and replaces partition
wall-orientation APIs; behaviour is gated to 2024 walls with word 1, but
export geometry and thickness metadata shift for many angled and
over-wide-box walls.
> 
> **Overview**
> **Revit 2024 wall geometry** is now built from the stored location
line as a **centreline** at the wall type’s **compound-structure
thickness**, instead of always using the partition record’s axis-aligned
bounding box.
> 
> For walls whose orientation word is **1**, `attach_wall_layers` writes
centreline endpoints and type thickness into element fields;
`export_content::wall_centreline_body` turns that into a plan rectangle
(axis-parallel walls keep join-trimmed run length; angled walls use
box-closure or joint-to-joint rules, with fallbacks for cut/profiled
boxes). The centreline body **replaces the bbox only when it differs**,
tagging `BodySource` `partition_wall_centreline` and `ThicknessSource`
`wall_type_compound_structure`. **RE-53 layered drawing** benefits
because more walls have a body thick enough for per-layer bands.
> 
> `wall_flip` / `scan_wall_flips` are **replaced** by `wall_orientation`
/ `scan_wall_orientations` (`WallOrientation`: location-line setting,
word, flip). Docs, support matrix, and
**`tools/re/wall_bodies_vs_ifc.py`** record Snowdon vs Revit IFC4 body
comparisons.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
4d18785. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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