Title: finish_editing_door/_window: crash when the filling's type has no representation; styles and material association dropped when it succeeds · Issue #9283 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: finish_editing_door/_window: crash when the filling's type has no representation; styles and material association dropped when it succeeds · Issue #9283 · IfcOpenShell/IfcOpenShell
X Title: finish_editing_door/_window: crash when the filling's type has no representation; styles and material association dropped when it succeeds · Issue #9283 · IfcOpenShell/IfcOpenShell
Description: Environment Bonsai / IfcOpenShell 0.8.5, Blender 5.2.0 LTS, Windows Model schema IFC4X3_ADD2, length unit METRE, contexts Model/Body/MODEL_VIEW + Model/FootPrint/PLAN_VIEW + Plan/Axis/GRAPH_VIEW (no Model/Profile/ELEVATION_VIEW) Both fin...
Open Graph Description: Environment Bonsai / IfcOpenShell 0.8.5, Blender 5.2.0 LTS, Windows Model schema IFC4X3_ADD2, length unit METRE, contexts Model/Body/MODEL_VIEW + Model/FootPrint/PLAN_VIEW + Plan/Axis/GRAPH_VIEW (n...
X Description: Environment Bonsai / IfcOpenShell 0.8.5, Blender 5.2.0 LTS, Windows Model schema IFC4X3_ADD2, length unit METRE, contexts Model/Body/MODEL_VIEW + Model/FootPrint/PLAN_VIEW + Plan/Axis/GRAPH_VIEW (n...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/9283
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"finish_editing_door/_window: crash when the filling's type has no representation; styles and material association dropped when it succeeds","articleBody":"### Environment\n\n- Bonsai / IfcOpenShell **0.8.5**, Blender **5.2.0 LTS**, Windows\n- Model schema `IFC4X3_ADD2`, length unit METRE, contexts `Model/Body/MODEL_VIEW` + `Model/FootPrint/PLAN_VIEW` + `Plan/Axis/GRAPH_VIEW` (no `Model/Profile/ELEVATION_VIEW`)\n\nBoth findings below are triggered by the same operator and were reproduced on an 11-product file reduced from a production model. Happy to attach that file if useful.\n\n---\n\n## Finding 1 — crash when the filling's type carries no representation\n\n`bim.finish_editing_door` / `bim.finish_editing_window` aborts whenever the filling has an `IfcTypeProduct` that has no `RepresentationMap`.\n\n```\nFile \"bonsai/bim/module/model/door.py\", line 164, in update_door_modifier_representation\n tool.Model.update_simple_openings(element)\nFile \"bonsai/tool/model.py\", line 1786, in update_simple_openings\n new_representation = FilledOpeningGenerator().generate_opening_from_filling(...)\nFile \"bonsai/bim/module/model/opening.py\", line 346, in generate_opening_from_filling\n filling_geometry = ifcopenshell.geom.create_shape(settings, filling_body)\nAttributeError: 'NoneType' object has no attribute 'wrapped_data'\n```\n\nCause, from `generate_opening_from_filling`:\n\n```python\nfilling_type = ifcopenshell.util.element.get_type(filling)\nif filling_type:\n profile = get_representation(filling_type, \"Model\", \"Profile\", \"ELEVATION_VIEW\")\n filling_obj = tool.Ifc.get_object(filling_type) # switched to the TYPE\n...\nfilling_element = tool.Ifc.get_entity(filling_obj) # = the type\nfilling_body = get_representation(filling_element, context) # None\nfilling_geometry = ifcopenshell.geom.create_shape(settings, filling_body)\n```\n\nOnce the filling is typed, geometry is looked up on the **type**. If the type has neither a `Model/Profile/ELEVATION_VIEW` nor a `Model/Body/MODEL_VIEW` representation, `None` reaches `create_shape`.\n\nReproduced with a door whose type has exactly **one** occurrence, in a normal 115 mm wall with a valid Body representation — so it is not related to shared types or to hosts without geometry.\n\n**Relation to #8215:** identical traceback signature, different trigger. #8215 was resolved by restricting when the gizmo is shown; the `None` guard inside `generate_opening_from_filling` was not added, and this path is unaffected by that change.\n\n**Workaround, and a second crash on the way there.** Giving the type a `Model/Body/MODEL_VIEW` representation fixes it — but the change has to go through disk. The loader creates the type's Blender object mesh during import (`Create element types`). If the `RepresentationMap` is added in the running session, the type object stays an EMPTY with `obj.data is None` and `finish` then fails earlier:\n\n```\nFile \"bonsai/bim/module/model/door.py\", line 100, in update_door_modifier_representation\n tool.Model.replace_object_ifc_representation(body, obj, model_representation)\n...\nFile \"bonsai/tool/geometry.py\", line 1147, in record_object_materials\n props = tool.Geometry.get_mesh_props(obj.data)\nAttributeError: 'NoneType' object has no attribute 'BIMMeshProperties'\n```\n\nThis looks close to PR #8381 (*add door geometry to an object with no mesh data*, #7117), though I have not verified that the PR covers this path.\n\n---\n\n## Finding 2 — styles and material association are dropped on success\n\nWhen `finish` does run, it rebuilds the Body representation and the element loses its appearance data. Measured before and after on the same element:\n\n| | before | after |\n|---|---|---|\n| Body representation | `#46474` | `#47434` (new, old removed) |\n| `IfcStyledItem` per item | `[1, 1, 1]` | `[0, 0, 0]` |\n| Blender material slots | 2 (opaque frame, glass at alpha 0.28) | none |\n\nThe `IfcStyledItem`s were bound to the representation items, so losing them with the items is arithmetically unavoidable. The **material** route, however, is also lost:\n\n| | before | after |\n|---|---|---|\n| `ifcopenshell.util.element.get_material(element)` | `Glas ESG DIN EN 12150` | `None` |\n| `IfcRelAssociatesMaterial` referencing the element | 1 | **0** |\n\nSetup for that second table: item-bound styled items removed first, then `style.assign_material_style` + `material.assign_material`, then the representation switched so Blender shows exactly one slot (the material's style, alpha 0.28). After `finish`, the association relationship is gone from the file — the material entity and its `IfcMaterialDefinitionRepresentation` survive, only the link to the element is removed.\n\nIFC 4.3.2, 8.12.3.28 `IfcStyledItem` describes both routes as valid — via `IfcProductDefinitionShape` with an `Item`, or via `IfcMaterialDefinitionRepresentation` without one. Neither survives the operator, so there is currently no way to keep colour on an element that is edited through the door/window panel.\n\n---\n\n## Note on opening regeneration\n\nRelated but not reported here as a defect: `update_simple_openings` regenerates the `IfcOpeningElement` from the filling, with `opening_size = Vector([x, z])` overridden by `OverallWidth` / `OverallHeight`. An authored opening that is deliberately larger than its filling therefore shrinks on every edit — measured: `-0.070…2.010` became `0.000…2.010`. This is consistent with #4988, which was closed without changing the behaviour, so I assume it is intended.\n\n---\n\n## Preconditions to reproduce\n\n1. A typed `IfcDoor` or `IfcWindow` filling an opening, where the type has **no** `RepresentationMap` → Finding 1\n2. The same filling with a type that **does** carry a Body representation, loaded from disk, with `IfcStyledItem`s on its representation items and/or an associated `IfcMaterial` → Finding 2\n\nI have a minimal 11-product `IFC4X3_ADD2` file that reproduces both and can attach it. I did not verify whether either finding reproduces in a fresh Demo Project — its types carry representations, so Finding 1 would not trigger there without first removing them.\n","author":{"url":"https://github.com/M-H-H-B","@type":"Person","name":"M-H-H-B"},"datePublished":"2026-08-09T20:50:00Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/9283"}
| 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:ce50e4a1-ae86-13d0-c449-eb46f22588a4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B8D2:15C795:83CADF:B1D71F:6B04AB0C |
| html-safe-nonce | e475d52a49280d0948e49da322ec3eac2eb49733ac0e39ec7be06403d8c5b6e9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOEQyOjE1Qzc5NTo4M0NBREY6QjFENzFGOjZCMDRBQjBDIiwidmlzaXRvcl9pZCI6IjY2Mjg4OTc2MTUwMDg1NDE0NTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 612905136df28ee6113e8c0b6bcad495abed1c57eaaeb2581a671c84f2b5ca94 |
| hovercard-subject-tag | issue:5104664495 |
| 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/9283/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bba49c552eb1dc7adbb82f13576b29902d5a0b59152cd090a77a7ff6231628c0/IfcOpenShell/IfcOpenShell/issues/9283 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bba49c552eb1dc7adbb82f13576b29902d5a0b59152cd090a77a7ff6231628c0/IfcOpenShell/IfcOpenShell/issues/9283 |
| og:image:alt | Environment Bonsai / IfcOpenShell 0.8.5, Blender 5.2.0 LTS, Windows Model schema IFC4X3_ADD2, length unit METRE, contexts Model/Body/MODEL_VIEW + Model/FootPrint/PLAN_VIEW + Plan/Axis/GRAPH_VIEW (n... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | M-H-H-B |
| hostname | github.com |
| expected-hostname | github.com |
| None | f1d110ea058a0915c1d8aa3fc2069fa15801e128f591e5762525abe77490ecb1 |
| 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 | ffa22a65e4c46d376940fe34b05e6a7e9c7fdb9b |
| 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