Skip to content

feat(elements): draw shed roofs along their slope from their sketch lines' slope blocks (RE-56) - #362

Merged
DrunkOnJava merged 1 commit into
mainfrom
feat/roof-slopes
Sep 24, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
feat/roof-slopes

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

Shed roofs are drawn along their slope (RE-56, #356).

  • The edge's slope. Each sketch line of a footprint roof carries its edge's slope block: the slope angle (9:12 by default), and flags that say whether the edge defines the roof's slope. A defining edge also carries −rise/run.
  • The roof. A Revit 2024 roof with exactly one defining edge now rises from that edge at its slope, with its type's thickness square to the slope. It is written as an IfcFacetedBrep in IFC, and drawn in glTF and the viewer. It is drawn so only when the rise and thickness reproduce the roof's recorded height to 1e-4 ft.
  • Roof type layers. A roof type's layers follow its name and u32 0. The "2d 00 framing" RE-53 saw on 2025 floors was that same pattern, with types named "-". find_layers now accepts any length-prefixed name there.

Measured on the Autodesk tutorial house (MIT 4.567 copy, Revit 2024, local only, no export of Revit's own):

roof defining edges recorded height drawn
169835 1 (1:12) 2.959193880 ft rising at 1:12 over 20.458 ft; 20.458 × tan θ + 1.25 / cos θ = 2.9591938797 ft
169797, 169813, 170174 0 1.25 ft level plates, as before

IfcOpenShell meshes rvt-rs's IFC of roof 169835 as a faceted brep: its underside lies at the base plus its distance from the edge over 12, and its top 1.25 / cos θ above, to 2e-6 ft.

Motivation

A sloped roof exported as a level plate its whole rise tall was the most visible wrong shape left on a house. #356 needed an oracle; the tutorial house supplies one, with the record box as the check.

Changes

  • src/partition_roof_slopes.rs (new): edge_slope / scan_edge_slopes read the block. On a defining edge the stored rise/run must equal −tan of the angle.
  • src/partition_compound_structure.rs: the name-framed layer count, generalised from "hyphens" to any printable name.
  • src/partition_schema_mvp.rs: attach_roof_slopes requires a sketch outline, a type, a slope block on every edge (exactly one defining), and the defining edge's bounded line. It records the edge, angle and type thickness; roof_slope_from_fields reads them back.
  • src/ifc/body_geometry.rs: sloped_slab_mesh.
  • src/ifc/export_content.rs: roof_slope_solid and BodySource partition_roof_slope.
  • reports/element-framing/RE-56-roof-slopes.md, the roof support-matrix row, README roofs row, reconnaissance addendum, status, viewer profile, CHANGELOG.

Testing

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

  • The tutorial house (sha256 763f239e…): rvt-ifc, meshed by IfcOpenShell as above.
  • Snowdon Towers: the GLB is byte-identical to before. Its 18 roofs with sketch lines have no defining edge and stay plates.
  • Core Interior: the IFC is identical but for timestamps.
  • fmt, clippy -D warnings, rustdoc -D warnings, the existing workspace suite, and the MSRV let-chain scan.

What this does not do

  • Hip and gable roofs (two or more defining edges). No oracle has one.
  • A slope set some other way. Snowdon's 2112673 has no defining edge, yet Revit's export slopes it; a slope arrow is the likely carrier.
  • Overhang and rafter cut: not read. The height check refuses a roof whose shape they change.
  • Revit 2025 roofs: sketch outlines are read on 2024 only.

Audit-honesty checklist

  • Status partial. One sloped roof measured, and the check is Revit's own recorded height, stated as such.
  • RE finding: report and reconnaissance addendum.
  • No emojis, private paths or personal data.

Legal and contribution hygiene

  • Apache-2.0
  • Clean-room: byte observations of sketch-line and type data.
  • The tutorial house and Snowdon stay local.

Breaking changes

None.

Related issues

Refs #356.


Note

Medium Risk
Changes partition parsing and IFC body selection for roofs with a new geometry path, but scope is narrow (2024 shed roofs with one defining edge) and fails closed on the height check.

Overview
Shed roofs (RE-56) now export as sloped geometry instead of flat plates when partition data supports it.

The PR adds partition_roof_slopes to read per-edge slope blocks from Revit 2024 roof sketch lines (angle, defining-edge flags, −rise/run). attach_roof_slopes wires roofs that have a sketch outline, type layers, a slope block on every edge, and exactly one defining edge—recording the edge line, angle, and summed type thickness on the element.

IFC/glTF/viewer bodies use sloped_slab_mesh and roof_slope_solid, emitting an IfcFacetedBrep with thickness measured square to the slope, only when rise plus vertical thickness matches the record box height within 1e-4 ft. Hip/gable roofs, roofs without a defining edge, and other slope mechanisms (e.g. slope arrows) stay level plates.

partition_compound_structure::find_layers is broadened so roof type layer stacks parse behind any printable UTF-16 type name (not only the hyphen framing seen on some 2025 floor types), enabling roof thickness for the slope solid.

Reviewed by Cursor Bugbot for commit 68d9c22. Configure here.

…ines' slope blocks (RE-56)

Each sketch line of a footprint roof carries its edge's slope block: the
slope angle (9:12 by default), 16 zero bytes, 32 ff, a small negative
i64, a u32, u32 7, then flags 00 00 01 00, or 01 01 01 00 on an edge that
defines the roof's slope followed by -rise/run (partition_roof_slopes).

A roof type's layers follow its name and u32 0; the "2d 00" framing
RE-53 recorded on 2025 floors was a type named "-". find_layers now
accepts any length-prefixed name there, and Snowdon and Core Interior
are unchanged by it.

A 2024 roof with exactly one defining edge gets that edge, its angle and
its type's thickness (attach_roof_slopes), and is drawn rising from the
edge with the thickness square to the slope, as an IfcFacetedBrep, only
when that reproduces its record box height within 1e-4 ft. On the
Autodesk tutorial house the one sloped roof, 1:12 over 20.458 ft with a
1.25 ft type, gives 2.9591938797 ft against the recorded 2.959193880 ft.
Hip and gable roofs and roofs sloped some other way stay level plates.
@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_674b573e-3faf-40ed-b1ab-22f79cb91e8d)

@DrunkOnJava
DrunkOnJava merged commit 8225d1e into main Sep 24, 2026
23 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/roof-slopes branch September 24, 2026 02:01
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