Pick Point by Ray
ray_pickUse this when you need the faces a ray hits in a local Studio model, nearest first, with points, distances, and normals. Inputs are model units (mm); direction is normalized. Requires the local Studio URL and session token for the same script, reads the current model generation, and returns a set_selection argument object with every hit. feature_id must identify a displayed terminal shape; intermediates have no current viewer shapeIndex. Intersections use the viewer per-face tessellation, so curved-surface points and normals are mesh approximations.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Inline kernelCAD script source. | |
| file | No | Path to a .kcad.ts script. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project. | |
| origin | Yes | Ray origin [x, y, z] in model units. | |
| session | Yes | Studio sessionToken for this script, from GET /__kernelcad/session?script=<path>. | |
| direction | Yes | Nonzero ray direction [x, y, z]; normalized internally. | |
| feature_id | No | Displayed terminal feature to ray-pick; defaults to the returned feature. Intermediate features are not available as current viewer selections. | |
| studio_url | Yes | Local Studio HTTP origin, e.g. http://localhost:5173. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||