Query Geometry
queryUse this when you need to resolve or inspect topology against a script's lowered geometry. Pass the script as code (inline; works on a hosted server) or file. Selected by mode (default 'evaluate'):
'evaluate' — list the faces a Query matches ({ query }). Pass expect:'unique' to assert exactly-one.
'resolve' — resolve one ref to one face ({ ref }).
'lineage' — the creating/modifying history of a face ({ ref }; feature_id defaults to the last feature). Query forms (faces only; edge/vertex kinds return query.unsupported-entity-type):
a bare face label: 'top', 'bottom', 'left', 'right', 'front', 'back', or a hole/cutout slot like 'wall'.
@kc[/face/] — feature ids are the ones refs print, e.g. '@kc[box_1/face/top]', '@kc[hole_1/face/wall]'.
@kcq[face(, ...)] — filters AND together: createdBy("box_1"), withLabel("top"), geometryType(PLANE|CYLINDER|CONE|SPHERE|TORUS|BSPLINE_SURFACE), closestTo([x,y,z]) or closestTo([x,y,z], k), containsPoint([x,y,z]); combine with union(a, b), intersection(a, b), subtraction(a, b). Example: '@kcq[face(geometryType(CYLINDER), closestTo([0,0,10]))]'. Each matched face comes back with its canonical @kc ref, centroid, normal and area.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | mode:'resolve'|'lineage' — one face: '@kc[box_1/face/top]', '@kcq[...]', or '<feature-id>.<label>' (lineage). | |
| code | No | Inline kernelCAD script source. | |
| file | No | Path to a .kcad.ts script file. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project. | |
| mode | No | Resolution mode (default 'evaluate'). | |
| query | No | mode:'evaluate' — Query: a bare face label ('top'), an @kc[<feature-id>/face/<label>] ref, an @kcq[face(...)] expression, or { ast }. | |
| expect | No | mode:'evaluate' — 'unique' asserts exactly-one. | |
| feature_id | No | Optional FeatureId; defaults to the last lowered shape (use "auto" for lineage). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||