Title: Snap performance — why not use context.scene.ray_cast()? · Issue #8008 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: Snap performance — why not use context.scene.ray_cast()? · Issue #8008 · IfcOpenShell/IfcOpenShell
X Title: Snap performance — why not use context.scene.ray_cast()? · Issue #8008 · IfcOpenShell/IfcOpenShell
Description: Feature Description Snap performance — why not use context.scene.ray_cast()? I have been looking with Calude Code at the performance of the polyline snap system in the BIM authoring tools (wall, slab, door placement etc.) and ran some ex...
Open Graph Description: Feature Description Snap performance — why not use context.scene.ray_cast()? I have been looking with Calude Code at the performance of the polyline snap system in the BIM authoring tools (wall, sl...
X Description: Feature Description Snap performance — why not use context.scene.ray_cast()? I have been looking with Calude Code at the performance of the polyline snap system in the BIM authoring tools (wall, sl...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/8008
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Snap performance — why not use context.scene.ray_cast()?","articleBody":"### Feature Description\n\nSnap performance — why not use context.scene.ray_cast()?\n \nI have been looking with Calude Code at the performance of the polyline snap system in the BIM authoring tools (wall, slab, door placement etc.) and ran some experiments replacing the custom BVH pipeline with Blender's built-in context.scene.ray_cast().\n\nThe current implementation builds Python BVH trees per-object in a background thread, maintains a bbox rebuild system to filter which objects to raycast against, and uses a timer to apply results asynchronously. It works, but on large models the bbox rebuild and BVH construction introduce noticeable lag. \n \nWe replaced this entire pipeline with a single call: \nhit, location, normal, face_index, obj, matrix = context.scene.ray_cast(depsgraph, origin, direction)\n\nThis gives us the face directly under the cursor. We then take the face's 3–4 vertices, project them to screen space, and find the closest vertex, midpoint, or edge point within pixel thresholds — no BVH building, no bbox filtering, no background thread needed.\n\nThe result is noticeably faster snapping and the code went from ~200 lines to ~50. \n\nThe question: Was there a specific reason the snap system was built around a custom Python BVH rather than scene.ray_cast()? Is there something scene.ray_cast() can't do that the BVH approach handles — for example x-ray mode, hidden geometry, or snapping to objects not visible to the camera?","author":{"url":"https://github.com/tagehedin","@type":"Person","name":"tagehedin"},"datePublished":"2026-04-25T20:28:34Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/8008"}
| 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:2fb53d74-87ad-60a5-c334-cbf4ad0ed3c9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 939E:A09E4:771A7:A529A:6B04AAFD |
| html-safe-nonce | b099f69eae76cac69be73a9cb6667c87e882cac06050a711ed77a2ac9a12103b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzlFOkEwOUU0Ojc3MUE3OkE1MjlBOjZCMDRBQUZEIiwidmlzaXRvcl9pZCI6IjExMzg1MjM3Nzg1NzMwNTM0MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9bd0c95295d5b2964d60d91591b965cb3107ff6527e75ff2d4a30bcfe3a60f72 |
| hovercard-subject-tag | issue:4329144580 |
| 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/8008/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7095b8c18167d1c0eaeb980cbe4cd8d969f0be4a0b5743cbbd866c0081e15f62/IfcOpenShell/IfcOpenShell/issues/8008 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7095b8c18167d1c0eaeb980cbe4cd8d969f0be4a0b5743cbbd866c0081e15f62/IfcOpenShell/IfcOpenShell/issues/8008 |
| og:image:alt | Feature Description Snap performance — why not use context.scene.ray_cast()? I have been looking with Calude Code at the performance of the polyline snap system in the BIM authoring tools (wall, sl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tagehedin |
| 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