Skip to main content
Glama

Add Curve

add_curve

Use this when you need a freeform/organic 3D curve — a body feature line, brow, spine rail, or G2 blend between panels — authored as a Curve3D into the user's .kcad.ts immediately before the last top-level return. One authoring path, selected by kind:

  • 'nurbs' — insert a nurbsCurve(controlPoints, opts?) declaration. Pass controlPoints as a Vec3[] (mm, at least 2 points). Optional NURBS knobs: degree (default 3), rational weights, explicit knots, closed.

  • 'hermite' — insert a hermiteG2(a, b) declaration: a quintic Hermite curve interpolating two endpoints with matching positions, tangents, and (optional) curvatures — bridges two curves with G2 continuity. Each endpoint is { point: Vec3, tangent: Vec3, curvature?: Vec3 } in mm; tangent magnitude ~ chord length; curvature defaults to [0,0,0] (G1-only). The returned binding has type Curve3D (peer to Shape / Surface) — consume it via add_variable_sweep (spine input), add_surface({ kind: 'boundary' }) (boundary curve), or downstream Curve3D-accepting features. Returns the modified code + diagnostics from re-evaluating. Side-effect-free. Each kind fails closed on its own missing required params.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aNokind:'hermite' — start endpoint.
bNokind:'hermite' — end endpoint.
codeYesThe .kcad.ts source code.
kindYesWhich curve-construction path to use.
knotsNokind:'nurbs' — optional explicit knot vector; missing => clamped-uniform inferred.
closedNokind:'nurbs' — optional periodic/closed-curve flag.
degreeNokind:'nurbs' — curve degree; default 3 (cubic).
weightsNokind:'nurbs' — optional rational weights, one per control point (same length as controlPoints).
binding_nameNoJS const name for the new Curve3D binding (default: _curve_<N>).
controlPointsNokind:'nurbs' — control points as Vec3 triples in mm; at least 2 entries.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • removedOutput schema / properties
      Removed value: -{
      -  "binding_name": {
      -    "description": "JS const name bound to the new construct (when one was created).",
      -    "type": "string"
      -  },
      -  "diagnostics": {
      -    "description": "Diagnostics from re-evaluating the modified source.",
      -    "items": {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  "error": {
      -    "description": "Failure message (present when ok is false).",
      -    "type": "string"
      -  },
      -  "new_code": {
      -    "description": "Modified .kcad.ts source (present on success). Caller persists it.",
      -    "type": "string"
      -  },
      -  "ok": {
      -    "description": "Whether the edit applied and re-evaluated cleanly.",
      -    "type": "boolean"
      -  }
      -}
    • removedOutput schema / required
      Removed value: -[
      -  "ok"
      -]
  2. Changed3 schema fields changed
    • addedInput schema / properties / b / properties / curvature / description
      Added value: +"Optional second derivative; defaults to [0, 0, 0] (G1-only)."
    • addedInput schema / properties / b / properties / point / description
      Added value: +"Endpoint position in mm."
    • addedInput schema / properties / b / properties / tangent / description
      Added value: +"First derivative of the curve at this endpoint."
  3. Changed1 schema field changed
    • addedInput schema / allOf
      Added value: +[
      +  {
      +    "if": {
      +      "properties": {
      +        "kind": {
      +          "const": "nurbs"
      +        }
      +      }
      +    },
      +    "then": {
      +      "required": [
      +        "controlPoints"
      +      ]
      +    }
      +  },
      +  {
      +    "if": {
      +      "properties": {
      +        "kind": {
      +          "const": "hermite"
      +        }
      +      }
      +    },
      +    "then": {
      +      "required": [
      +        "a",
      +        "b"
      +      ]
      +    }
      +  }
      +]
  4. Changed1 schema field changed
    • removedInput schema / allOf
      Removed value: -[
      -  {
      -    "if": {
      -      "properties": {
      -        "kind": {
      -          "const": "nurbs"
      -        }
      -      }
      -    },
      -    "then": {
      -      "required": [
      -        "controlPoints"
      -      ]
      -    }
      -  },
      -  {
      -    "if": {
      -      "properties": {
      -        "kind": {
      -          "const": "hermite"
      -        }
      -      }
      -    },
      -    "then": {
      -      "required": [
      -        "a",
      -        "b"
      -      ]
      -    }
      -  }
      -]
  5. Changed1 schema field changed
    • addedInput schema / allOf
      Added value: +[
      +  {
      +    "if": {
      +      "properties": {
      +        "kind": {
      +          "const": "nurbs"
      +        }
      +      }
      +    },
      +    "then": {
      +      "required": [
      +        "controlPoints"
      +      ]
      +    }
      +  },
      +  {
      +    "if": {
      +      "properties": {
      +        "kind": {
      +          "const": "hermite"
      +        }
      +      }
      +    },
      +    "then": {
      +      "required": [
      +        "a",
      +        "b"
      +      ]
      +    }
      +  }
      +]
  6. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "binding_name": {
      +      "description": "JS const name bound to the new construct (when one was created).",
      +      "type": "string"
      +    },
      +    "diagnostics": {
      +      "description": "Diagnostics from re-evaluating the modified source.",
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "error": {
      +      "description": "Failure message (present when ok is false).",
      +      "type": "string"
      +    },
      +    "new_code": {
      +      "description": "Modified .kcad.ts source (present on success). Caller persists it.",
      +      "type": "string"
      +    },
      +    "ok": {
      +      "description": "Whether the edit applied and re-evaluated cleanly.",
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "ok"
      +  ],
      +  "type": "object"
      +}
  7. Added

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.