Title: NetSideArea / GrossSideArea use wrong face on Y-oriented walls · Issue #9237 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: NetSideArea / GrossSideArea use wrong face on Y-oriented walls · Issue #9237 · IfcOpenShell/IfcOpenShell
X Title: NetSideArea / GrossSideArea use wrong face on Y-oriented walls · Issue #9237 · IfcOpenShell/IfcOpenShell
Description: Bug Description This testmodel is full of discoveries :) Testmodel.ifc.txt Summary For walls whose length runs along local Y (thickness along X), Bonsai QTO reports NetSideArea ≈ the end face area instead of the elevational side area. So...
Open Graph Description: Bug Description This testmodel is full of discoveries :) Testmodel.ifc.txt Summary For walls whose length runs along local Y (thickness along X), Bonsai QTO reports NetSideArea ≈ the end face area ...
X Description: Bug Description This testmodel is full of discoveries :) Testmodel.ifc.txt Summary For walls whose length runs along local Y (thickness along X), Bonsai QTO reports NetSideArea ≈ the end face area ...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/9237
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"NetSideArea / GrossSideArea use wrong face on Y-oriented walls","articleBody":"### Bug Description\n\nThis testmodel is full of discoveries :) [Testmodel.ifc.txt](https://github.com/user-attachments/files/30661338/Testmodel.ifc.txt)\n\n## Summary\n\nFor walls whose length runs along **local Y** (thickness along X), Bonsai QTO reports `NetSideArea` ≈ the **end face** area instead of the **elevational side** area. Solibri reports the correct elevation area.\n\nHardcoded `main_axis=\"x\"` in `get_net_side_area` / `get_gross_side_area` causes this.\n\n## Environment\n\n- Bonsai (Blender 5.1 / 5.2 bonsaiPR) — `bonsai.bim.module.qto.calculator`\n- Rule set: `IFC4QtoBaseQuantitiesBlender`\n- Test file: Revit IFC4 export with tessellated wall bodies\n\n## Symptom\n\nExample wall: `GlobalId = \"28smR2HdnDTwB_9bNuGXiG\"` \n(`IfcWall`, `Basic Wall:22_OW_HSB_260mm`)\n\n| Source | NetSideArea | GrossSideArea |\n|---|---|---|\n| **Solibri** | **4.24 m²** | **9.60 m²** |\n| **Bonsai** | **1.149 m²** | **1.149 m²** |\n\nSame wrong ~1.15 m² Net/Gross on these GlobalIds (same wall type, storeys A-04 / A-05 / A-06):\n\n- `3tvLG0IW588fGiE82pfHkJ`\n- `0MtPlpjv53oewZlKiNYCan`\n- `28smR2HdnDTwB_9bNuGXiG`\n- `11hDQrh5r9oA3IFk8xT7uM`\n- `1LyztsM459p9F0r7DHXwsr`\n- `2k0liE_bbEQvLYpgd0NHwv`\n\n## Geometry evidence (IfcOpenShell)\n\nWall bbox / side areas for `28smR2HdnDTwB_9bNuGXiG`:\n\n```text\nbbox: x=0.260 y=3.595 z=2.670 ← length along Y, thickness along X\nL×H: max(x*z, y*z) = 9.5987 ← matches Solibri Gross 9.60\nsideX: get_side_area(axis=\"X\") = 4.2437 ← matches Solibri Net 4.24\nsideY: get_side_area(axis=\"Y\") = 1.1492 ← matches Bonsai 1.149\n```\n\nSo Bonsai is measuring the **short end** (view along Y), not the **long elevation** (view along X).\n\nWalls that run along X are unaffected (long faces have Y normals — the hardcoded axis happens to be correct).\n\nIn the test model: **12 / 156** walls are longer in Y; all of them show this mismatch.\n\n## Root cause\n\n```python\n# bonsai.bim.module.qto.calculator\n\ndef get_net_side_area(obj):\n return get_lateral_area(obj, exclude_end_areas=True, main_axis=\"x\") / 2\n\ndef get_gross_side_area(obj):\n if not has_openings(obj):\n return get_net_side_area(obj)\n return get_lateral_area(obj, exclude_end_areas=True, subtract_openings=False, main_axis=\"x\") / 2\n```\n\n`main_axis=\"x\"` is hardcoded. Inside `get_lateral_area`:\n\n```python\nmain_axis_guess = get_object_main_axis(obj)\nif main_axis_guess == \"x\" or main_axis == \"x\": # always True when caller passes \"x\"\n main_axis_v = x_axis\n side_axis = y_axis\n ...\n```\n\nWith `exclude_end_areas=True`, faces whose normal aligns with `main_axis_v` are treated as ends and **dropped**.\n\n| Wall orientation | Long-face normals | Effect of forcing `main_axis=\"x\"` |\n|---|---|---|\n| Length along **X** (thickness Y) | ±Y | Long faces kept → correct |\n| Length along **Y** (thickness X) | ±X | Long faces dropped as “ends” → only short ends remain → ~1.15 m² |\n\n`get_object_main_axis()` would return `\"y\"` for these walls (longest bbox edge), but the hardcoded `\"x\"` overrides it.\n\n## Related issue (same walls)\n\n`GrossSideArea == NetSideArea` here for a second reason already reported separately:\n\n- Body is `Tessellation` with openings baked into the mesh\n- `HasOpenings` is empty → `get_gross_side_area` early-returns `get_net_side_area`\n- Solibri Gross = L×H (9.60); Bonsai never reaches a true gross path\n\nEven after fixing Gross≠Net for tessellated walls, **Net would still be wrong** on Y-oriented walls until the axis bug is fixed.\n\n## Expected behaviour\n\nPer IFC4 `Qto_WallBaseQuantities`:\n\n- **NetSideArea** — elevation area of the wall middle plane, excluding openings \n → here ≈ **4.24 m²** (`max` side area / elevational face)\n- **GrossSideArea** — same plane, including openings \n → here ≈ **9.60 m²** (Length × Height)\n\n## Proposed fix\n\n1. **Stop hardcoding** `main_axis=\"x\"` in `get_net_side_area` / `get_gross_side_area`.\n2. Pass the detected main axis, e.g. `main_axis=get_object_main_axis(obj)`, **or** leave `main_axis=\"\"` and rely on the guess only.\n3. Add a regression test:\n - wall longer in X → SideArea ≈ Y-facing elevation\n - wall longer in Y → SideArea ≈ X-facing elevation \n Fixture GlobalIds above; assert Net ≈ 4.24, not ≈ 1.15.\n4. Optional simpler alternative for SideArea: `get_max_side_area(geometry) / 2` equivalent (largest elevational face), which matches Solibri Net on these walls.\n\nAlso revisit the `main_axis_guess == \"y\"` branch in `get_lateral_area` (it currently maps `side_axis = z_axis`), once callers stop forcing `\"x\"`.\n\n## Repro\n\n1. Open a model with a wall longer along Y than X (e.g. the GlobalIds above).\n2. Run **Perform Quantity Take-off** (`IFC4QtoBaseQuantitiesBlender`).\n3. Read `Qto_WallBaseQuantities.NetSideArea`.\n4. Compare to Solibri NetSideArea or to `ifcopenshell.util.shape.get_side_area(geom, axis=\"X\")` when `get_y(geom) > get_x(geom)`.\n\n## Impact\n\nAny non-X-aligned wall gets a systematically wrong (usually much too small) SideArea. Quantity takeoff, formwork estimates, and cost links that use `NetSideArea` / `GrossSideArea` are wrong for those elements.\n\n@BIMvoice \n\n### Attachments\n\n_No response_\n\n### Debug and Error Output\n\n```true\n\n```","author":{"url":"https://github.com/PahlawanJoey","@type":"Person","name":"PahlawanJoey"},"datePublished":"2026-08-03T12:37:37Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/9237"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2a58797f-56bc-eb31-9f69-ce38d673ab73 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D754:300351:424AC2:5C37A9:6B047BFF |
| html-safe-nonce | a4a70a2f7d5f8c3f3ab100d00d249a863aed8840fc9b8aa1a0e35f38c2696f9a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzU0OjMwMDM1MTo0MjRBQzI6NUMzN0E5OjZCMDQ3QkZGIiwidmlzaXRvcl9pZCI6IjgxMTYzNDQzNDI2NjAyODMzOTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b23f999065d791868b661ed344115b8e196c0d278d95a0475e6456599f48c38e |
| hovercard-subject-tag | issue:5049856533 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/IfcOpenShell/IfcOpenShell/9237/issue_layout |
| twitter:image | https://opengraph.githubassets.com/734f0dcc7bbf7ce0fb6719afab71220bd89376305adb3ccbbd47c29f42912d40/IfcOpenShell/IfcOpenShell/issues/9237 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/734f0dcc7bbf7ce0fb6719afab71220bd89376305adb3ccbbd47c29f42912d40/IfcOpenShell/IfcOpenShell/issues/9237 |
| og:image:alt | Bug Description This testmodel is full of discoveries :) Testmodel.ifc.txt Summary For walls whose length runs along local Y (thickness along X), Bonsai QTO reports NetSideArea ≈ the end face area ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | PahlawanJoey |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0366ddfb372682a32e92a5d86155cb08fa83e5bbe79953a968789f2f7e24c511 |
| turbo-cache-control | no-preview |
| go-import | github.com/IfcOpenShell/IfcOpenShell git https://github.com/IfcOpenShell/IfcOpenShell.git |
| octolytics-dimension-user_id | 13692563 |
| octolytics-dimension-user_login | IfcOpenShell |
| octolytics-dimension-repository_id | 40473201 |
| octolytics-dimension-repository_nwo | IfcOpenShell/IfcOpenShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 40473201 |
| octolytics-dimension-repository_network_root_nwo | IfcOpenShell/IfcOpenShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ed3f2e01f6b7672780c586c8af0e72726374d7b6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width