FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Bonsai: cut and align skylights/windows on parametric roofs to the sloped face by BIMvoice · Pull Request #8930 · IfcOpenShell/IfcOpenShell · GitHub

Bonsai: cut and align skylights/windows on parametric roofs to the sloped face - #8930

Open
BIMvoice wants to merge 1 commit into
IfcOpenShell:v0.8.0from
BIMvoice:fix-5611-roof-skylight-cut
Open

Bonsai: cut and align skylights/windows on parametric roofs to the sloped face#8930
BIMvoice wants to merge 1 commit into
IfcOpenShell:v0.8.0from
BIMvoice:fix-5611-roof-skylight-cut

Conversation

Copy link
Copy Markdown
Contributor

Fixes #5611.

Adding a window/skylight to a parametric Roof left the filling vertical with no opening cut. get_material_layer_parameters() defaulted the layer set direction to AXIS2 (wall-like, translation only) whenever no material was found, and parametric roofs never get a material layer set, so they silently fell into the wall placement branch. The AXIS3 (slab-like) placement also assumed a single flat top face, so it wouldn't have aligned to a sloped face even with the right default.

This adds:

  • a class-based fallback for the layer direction (reusing the same class list get_usage_type() already uses) instead of hardcoding AXIS2 when there's no material to read LayerSetDirection from, and
  • a get_surface_aligned_rotation() helper that derives the rotation from the actual raycasted face normal, used only for hosts with no material layer set to read a flat elevation from.

Hosts with a real IfcMaterialLayerSetUsage (flat slabs, tilted "Horizontal Layers" roofs) keep the exact previous code path, so those working cases are unaffected by construction.

Test plan

  • Live-verified in headless Blender: a default hipped roof's skylight now rotates to match the sloped face exactly (rotation-dot-face-normal = 1.0, height axis z = sin(slope)) and cuts an opening; wall windows stay vertical and flat-slab skylights stay flat (both still cut correctly).
  • TestGetMaterialLayerParameters (5 cases) + test_get_surface_aligned_rotation.py (9 cases) added; full test/bim/module/model + test/tool suites pass (pre-existing unrelated failures confirmed on the base branch).
  • black + ruff clean.

Thanks @sboddy for the report.

Generated with the assistance of an AI coding tool.

Adding a window/skylight to a parametric IfcRoof left the filling
vertical with no opening cut, because roofs never get an
IfcMaterialLayerSetUsage. get_material_layer_parameters() defaulted the
layer set direction to AXIS2 (wall-like: translation only) whenever no
material was found, so a roof silently fell into the wall placement
branch instead of the slab-like AXIS3 one.

get_material_layer_parameters() now falls back to a class-based
direction (reusing the same class list get_usage_type() already uses)
when there's no material to read LayerSetDirection from, so IfcRoof/
IfcSlab/IfcRamp/IfcPlate default to AXIS3 instead of AXIS2.

That alone would only flatten the filling horizontally, since the
existing AXIS3 placement assumed a single flat top face (host's own
world rotation, twisted -90 degrees around X) and never looked at the
actual face being cut. A parametric roof's own object usually isn't
tilted at all even though individual faces are sloped, so a new
get_surface_aligned_rotation() helper derives the rotation from the
raycasted face normal instead, only for hosts with no material layer
set to read a flat elevation from. Hosts with a real material layer
set (the previously working flat-slab and whole-object-tilted "Horizontal
Layers" roof cases) keep the exact old code path, unchanged.

Verified live in headless Blender: a default hipped parametric roof's
skylight now rotates to match the sloped face exactly (thickness axis
dot product with the face normal is 1.0) and cuts a real opening. Wall
windows and flat-slab-with-material skylights are unaffected.

Fixes IfcOpenShell#5611.

This file was modified with the assistance of an AI coding tool.
BIMvoice added PR Proposed A PR has been proposed for this bug/feature. and removed PR Proposed A PR has been proposed for this bug/feature. labels Jul 27, 2026

sboddy commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Got around to looking at this. Took me a while to figure out. Part of the confusion is because when I did figure it out, it aligns the window, applies the void, but makes the entire roof disappear. Tabbing into it shows the roof geometry is still there. It just doesn't show up once the window is applied.

Roof after window has been added. The window is aligned. But no roof geometry.

The window hole is there, and can be toggled visible. But no roof geometry.

This is after tabbing into item mode with the roof selected in the outliner:

This happens for both parametric roofs, and plain mesh roofs. Slight wrinkle with parametric roofs is that when you exit out of editing the parametric roof, the roof is regenerated, and loses the window connection. You have to re-add it to the roof object (which is still broken as above of course).

sboddy commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Weird, but even freshly made opening objects have the same effect on roof objects. I need to revert your PR from my build and see if the problem goes away.

sboddy commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

OK, the issue predates your PR. I can't give confirmation that this PR fixes the original issue till I figure out why roof openings don't work. I'm looking into that.

sboddy commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

This fix gets a 👍️ from me. I've tested it working.

For information only (no action on your part) the issue I ran into is #9349 / #9349 which was confusing the testing.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows do not apply to roofs to act as skylights, even when predefined type is set

2 participants


Back | FazBrowse Home | New Git URL