Project Curve
project_curveUse this when you need to wrap a 2D curve onto a 3D face. Insert a <shape>.projectCurve({ curve, face, scaleMode?, asEdge? }) chained call into a kernelCAD script. Wraps a 2D closed curve onto a 3D face along the face normal; pair with .extrude(d) / .cut(...) for engraved logos or label inserts on curved bodies. asEdge: true is captured but currently deferred at lower time (BRepProj_Projection not bundled). Side-effect-free; returns modified code plus diagnostics.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The .kcad.ts source code. | |
| face | Yes | Target face — canonical name or label. | |
| asEdge | No | Project as an open edge instead of a closed face-bound sketch. Currently deferred. | |
| bindAs | No | Optional local variable name; emits `const <bindAs> = <target>.projectCurve(...);`. | |
| target | Yes | Variable name of the Shape to chain onto. | |
| scaleMode | No | Drawing.sketchOnFace scaling mode. Default original. | |
| curveExpression | Yes | JS expression returning a closed sketch (e.g. `path().moveTo(0,0).lineTo(2,0).lineTo(2,2).close().build()`). Inserted verbatim as the `curve:` field. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Whether the edit applied and re-evaluated cleanly. | |
| error | No | Failure message (present when ok is false). | |
| new_code | No | Modified .kcad.ts source (present on success). Caller persists it. | |
| diagnostics | No | Diagnostics from re-evaluating the modified source. | |
| binding_name | No | JS const name bound to the new construct (when one was created). |