Title: Bonsai: object snapping skips a covering/solid coincident with a wall or slab · Issue #9003 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: Bonsai: object snapping skips a covering/solid coincident with a wall or slab · Issue #9003 · IfcOpenShell/IfcOpenShell
X Title: Bonsai: object snapping skips a covering/solid coincident with a wall or slab · Issue #9003 · IfcOpenShell/IfcOpenShell
Description: Bug Description Object snapping (polyline / wall / slab placement, measure) cannot snap to an IfcCovering or an IfcBuildingElementPart when its geometry is coincident with, or sits directly on, another solid such as a wall or slab. The v...
Open Graph Description: Bug Description Object snapping (polyline / wall / slab placement, measure) cannot snap to an IfcCovering or an IfcBuildingElementPart when its geometry is coincident with, or sits directly on, ano...
X Description: Bug Description Object snapping (polyline / wall / slab placement, measure) cannot snap to an IfcCovering or an IfcBuildingElementPart when its geometry is coincident with, or sits directly on, ano...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/9003
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bonsai: object snapping skips a covering/solid coincident with a wall or slab","articleBody":"### Bug Description\n\nObject snapping (polyline / wall / slab placement, measure) cannot snap to an **IfcCovering** or an **IfcBuildingElementPart** when its geometry is coincident with, or sits directly on, another solid such as a wall or slab. The vertices/edges of the covering are simply never offered as snap points where it overlaps the other element. Snapping to the same covering works fine on a part that overhangs into empty space.\n\n### Steps to Reproduce\n\n1. Open a model with an `IfcCovering` (e.g. a floor/ceiling/wall finish) placed on an `IfcSlab`/`IfcWall`, or an `IfcBuildingElementPart` with a tessellated body coincident with another solid.\n2. Start the polyline/wall tool (or the measure tool).\n3. Hover the cursor over the covering **where it overlaps** the slab/wall.\n\n**Expected:** snap to the covering's vertices/edges.\n**Actual:** no snap on the covering; only the underlying element (or nothing) is picked. Moving over a portion of the covering that does **not** overlap any other solid snaps correctly.\n\n### Root Cause\n\nIn `Raycast.ray_cast_and_get_closest_to_camera_snaps` (`src/bonsai/bonsai/tool/raycast.py`), the non-xray path selects the snap target among the candidate solids by:\n\n1. sorting them by **object-origin distance** to the ray (`so.obj.matrix_world.translation - ray_origin`), and\n2. **stopping at the first face hit** (`break`).\n\nOnly that object is flagged `is_closest_to_camera`, and `detect_snapping_points` then generates vertex/edge snaps for that object alone. The object origin is a poor proxy for what is actually under the cursor (it can sit far from the geometry), so when two solids overlap, whichever origin sorts first wins — and a covering coincident with a wall/slab is skipped even though it is the front-most surface. Separated elements (e.g. plain walls) snap fine because the heuristic only misbehaves when solids overlap.\n\n### Suggested Fix\n\nRay cast every candidate solid under the cursor and keep the one with the **nearest actual hit distance** (which is what the xray path and `Raycast.cast_rays_and_get_best_object` already do), instead of the origin-sort + first-hit heuristic. The extra ray casts are limited to the few solids whose 2D bounding box is under the cursor, and `obj.ray_cast` is cheap.\n\nPR: (link on submission)\n\n### Related\n- #8008 — broader discussion on the snapping performance / raycast approach.\n\n### Environment\n\n- Bonsai `v0.8.0` (current)\n- Blender 5.1, Python 3.13, Windows\n","author":{"url":"https://github.com/carlopav","@type":"Person","name":"carlopav"},"datePublished":"2026-07-26T21:20:32Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/9003"}
| 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:a645f815-c3b4-36f2-2d57-2cd04bd92e0c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9362:195E8:76474:A140B:6B04AAFA |
| html-safe-nonce | 03613e8738705522ff2854eed47215eaa21705f766603062b45c8b9fca5c1097 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzYyOjE5NUU4Ojc2NDc0OkExNDBCOjZCMDRBQUZBIiwidmlzaXRvcl9pZCI6IjY0MzYxOTI0MjY4MjU5MTkyMjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | dc564d7b805f30a43a480951bf792ead28dfb0684c295d56be4a301bbdaadd02 |
| hovercard-subject-tag | issue:4982579942 |
| 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/9003/issue_layout |
| twitter:image | https://opengraph.githubassets.com/af2bf2dd6b412ecb77790ec497c011d3a0640d6121d3a890d780770d8aa78304/IfcOpenShell/IfcOpenShell/issues/9003 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/af2bf2dd6b412ecb77790ec497c011d3a0640d6121d3a890d780770d8aa78304/IfcOpenShell/IfcOpenShell/issues/9003 |
| og:image:alt | Bug Description Object snapping (polyline / wall / slab placement, measure) cannot snap to an IfcCovering or an IfcBuildingElementPart when its geometry is coincident with, or sits directly on, ano... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | carlopav |
| 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