Title: auto_detect_profiles silently loses voids when polygonize fails on a re-triangulated closed curve · Issue #8983 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: auto_detect_profiles silently loses voids when polygonize fails on a re-triangulated closed curve · Issue #8983 · IfcOpenShell/IfcOpenShell
X Title: auto_detect_profiles silently loses voids when polygonize fails on a re-triangulated closed curve · Issue #8983 · IfcOpenShell/IfcOpenShell
Description: Bug Description tool.Model.auto_detect_profiles can silently fail to detect voids, producing an IfcCompositeProfileDef where an IfcArbitraryProfileDefWithVoids is correct. The holes are not represented as voids in the resulting IFC. Foun...
Open Graph Description: Bug Description tool.Model.auto_detect_profiles can silently fail to detect voids, producing an IfcCompositeProfileDef where an IfcArbitraryProfileDefWithVoids is correct. The holes are not represe...
X Description: Bug Description tool.Model.auto_detect_profiles can silently fail to detect voids, producing an IfcCompositeProfileDef where an IfcArbitraryProfileDefWithVoids is correct. The holes are not represe...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/8983
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"auto_detect_profiles silently loses voids when polygonize fails on a re-triangulated closed curve","articleBody":"### Bug Description\n\n`tool.Model.auto_detect_profiles` can silently fail to detect voids, producing an `IfcCompositeProfileDef` where an `IfcArbitraryProfileDefWithVoids` is correct. The holes are not represented as voids in the resulting IFC.\n\nFound while implementing #6317; scoped out of that PR (#8982) because it affects far more than fill areas.\n\n### Mechanism\n\nIn `src/bonsai/bonsai/tool/model.py` (around line 2455), outer/inner containment is decided by polygonising the **triangulated** geometry's edges:\n\n```python\nedges = ifcopenshell.util.shape.get_edges(geometry)\nboundary_lines = [shapely.LineString([v[e[0]], v[e[1]]]) for e in edges]\nunioned_boundaries = shapely.union_all(shapely.GeometryCollection(boundary_lines))\nclosed_polygons = shapely.polygonize(unioned_boundaries.geoms)\nfor polygon in closed_polygons.geoms:\n polygons[curve] = polygon\n break\n```\n\nTwo problems here:\n\n1. **Silent failure.** If `polygonize` yields nothing, `polygons[curve]` is simply never assigned. That curve then takes no part in the `contains_properly` comparison below, so no containment is found, the odd/even nesting rule sees everything at level 0, and each boundary becomes its own profile inside an `IfcCompositeProfileDef`. Nothing warns. This reproduces for a closed polyline authored as a plain `IfcIndexedPolyCurve`, where the closing edge does not survive re-triangulation.\n2. **Only the first polygon is kept.** The loop `break`s after one, discarding any others `polygonize` returned, with no check that exactly one was expected.\n\n### Impact\n\nA profile with a hole round trips as a composite of two separate closed profiles rather than a boundary with a void. Downstream that is not the same shape: quantities, booleans and anything reading `IfcArbitraryProfileDefWithVoids.InnerCurves` see no void at all.\n\n### Suggested direction\n\nDerive containment from the curve definitions rather than from re-triangulated edges where possible, since the authored curve already knows whether it is closed. Failing that, at minimum detect the empty-`polygonize` case and surface it instead of silently degrading, so a user is told the profile could not be interpreted rather than getting quietly wrong IFC.\n\nI have not attempted a fix. This sits under the profile authoring path used well beyond the issue I found it from, so it seemed better to report it than to change it as a side effect of an unrelated PR.\n\ncc @Moult @Andrej730\n\n*This issue was written with the assistance of an AI coding tool.*\n","author":{"url":"https://github.com/petruconduraru","@type":"Person","name":"petruconduraru"},"datePublished":"2026-07-25T13:07:08Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/8983"}
| 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:92638255-78fa-f8e8-6e66-3618b20bcefe |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 83C4:1B13E8:5B9CC7:78D8DC:6B04C274 |
| html-safe-nonce | 03ed442b8040b38eae4d143cad6dfde898d390637556e70f5deded0672faeff4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4M0M0OjFCMTNFODo1QjlDQzc6NzhEOERDOjZCMDRDMjc0IiwidmlzaXRvcl9pZCI6IjgzNTAxNTcyMjk3Njg2MjI3MDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7f770c9ce0bb2dc7f1e531f8c9ba57073ca4a6821c1d1704f729952a9bc37192 |
| hovercard-subject-tag | issue:4975877718 |
| 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/8983/issue_layout |
| twitter:image | https://opengraph.githubassets.com/26bc823a2766bf611809b2c1d3d7e3bccf3ac01c81cdcacccee28521ec73a136/IfcOpenShell/IfcOpenShell/issues/8983 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/26bc823a2766bf611809b2c1d3d7e3bccf3ac01c81cdcacccee28521ec73a136/IfcOpenShell/IfcOpenShell/issues/8983 |
| og:image:alt | Bug Description tool.Model.auto_detect_profiles can silently fail to detect voids, producing an IfcCompositeProfileDef where an IfcArbitraryProfileDefWithVoids is correct. The holes are not represe... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | petruconduraru |
| hostname | github.com |
| expected-hostname | github.com |
| None | 85dd75377eb77313206b8fc108bcee6a3a029286d94bf32bf9b4426e4d92e0c4 |
| 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 | 0d64fa748a2bab9a5b587a967ac4da1cfa8da6dd |
| ui-target | canary-1 |
| 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