BadBit CAD operations
cad.draw.spline
Draws a spline (SPLINE) through fit points or by control vertices.
- Program: BadBit CAD
- Type of action: Changes the drawing
- Changes the drawing
- Since version 2027.0.0-beta.8
With method fit (the default) the curve passes through the points, with the knot parameterization and tolerance of the SPLINE command; with method cv the points are the control vertices and degree goes from 1 to 10 (default 3). closed makes it closed. Returns the identifier. In paper space (a layout on screen, outside the viewports), the coordinates and the measures are in mm; angles and scale factors do not change.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
closed | boolean | No | The polyline (or the spline) is closed (the last point connects to the first). |
degree | integer | null | No | Degree of the spline with control vertices (1 to 10). |
layer | string | null | No | Layer name. |
method | SplineMethod | No | fit (the curve passes through the points) or cv (control vertices). |
points | array<array<number>> | Yes | The points [[x, y], …], in order: the polyline vertices (at least 2), the fit or control points of the spline. |
Errors
| Code | JSON-RPC | Meaning |
|---|---|---|
invalid_params | -32602 | The parameters do not follow the schema or a rule of the operation. |
not_found | -32001 | The object, operation, file or name does not exist. |
conflict | -32004 | The current state does not allow this now. |
failed | -32005 | The operation failed. |
Example
MCP
JSON
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"arguments": {
"points": [
[
0,
0
],
[
10,
5
],
[
20,
0
],
[
30,
5
]
]
},
"operation": "cad.draw.spline"
},
"name": "badbit_call_operation"
}
}Python
Python
import badbit
result = badbit.cad.draw.spline(points=[[0, 0], [10, 5], [20, 0], [30, 5]])LISP
LISP
(badbit-call "cad.draw.spline" '(("points" . ((0 0) (10 5) (20 0) (30 5)))))JSON-RPC
JSON
{
"id": 1,
"jsonrpc": "2.0",
"method": "badbit/call",
"params": {
"arguments": {
"points": [
[
0,
0
],
[
10,
5
],
[
20,
0
],
[
30,
5
]
]
},
"operation": "cad.draw.spline"
}
}Commands that do the same
Full schema
JSON Schema 2020-12.
Parameters (input)
JSON
{
"$defs": {
"SplineMethod": {
"oneOf": [
{
"const": "fit",
"type": "string"
},
{
"const": "cv",
"type": "string"
}
]
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"closed": {
"default": false,
"description": "The polyline (or the spline) is closed (the last point connects to the first).",
"type": "boolean"
},
"degree": {
"default": null,
"description": "Degree of the spline with control vertices (1 to 10).",
"format": "uint32",
"maximum": 10,
"minimum": 1,
"type": [
"integer",
"null"
]
},
"layer": {
"default": null,
"description": "Layer name.",
"type": [
"string",
"null"
]
},
"method": {
"$ref": "#/$defs/SplineMethod",
"description": "fit (the curve passes through the points) or cv (control vertices)."
},
"points": {
"description": "The points [[x, y], …], in order: the polyline vertices (at least 2), the fit or control points of the spline.",
"items": {
"items": {
"format": "double",
"type": "number"
},
"maxItems": 2,
"minItems": 2,
"type": "array"
},
"maxItems": 100000,
"minItems": 2,
"type": "array"
}
},
"required": [
"points"
],
"type": "object"
}Result (output)
JSON
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"ids": {
"description": "Object identifiers (32 hexadecimal digits each).",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"ids"
],
"type": "object"
}