BadBit CAD operations
cad.annotate.table
Creates a table (TABLE, -TABLE).
- Program: BadBit CAD
- Type of action: Changes the drawing
- Changes the drawing
- Since version 2027.0.0-beta.8
Creates the TABLE table with the top left corner at position: with columns and data_rows (the data rows; the title and header come in addition, by the cell styles first_row and second_row), column_width and row_lines (the height in text lines); or with row_contents, the content row by row (like a table from CSV, the first row is the header). table_style picks the style (without it, the current one). 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 |
|---|---|---|---|
column_width | number | null | No | The column width, in drawing units. |
columns | integer | null | No | Number of columns. |
data_rows | integer | null | No | How many data rows (the title and header come in addition). |
first_row | RowKind | null | No | The cell style of the first row: title, header or data. |
position | array<number> | Yes | Position [x, y] of a point or of a text (the insertion point). |
row_contents | array<array<string>> | null | No | The table content, row by row [[text, …], …]. |
row_lines | integer | null | No | The row height, in text lines. |
second_row | RowKind | null | No | The cell style of the second row: title, header or data. |
table_style | string | null | No | The table style (it must exist). |
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
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"arguments": {
"columns": 3,
"data_rows": 2,
"position": [
0,
0
]
},
"operation": "cad.annotate.table"
},
"name": "badbit_call_operation"
}
}Python
import badbit
result = badbit.cad.annotate.table(columns=3, data_rows=2, position=[0, 0])LISP
(badbit-call "cad.annotate.table" '(("columns" . 3) ("data_rows" . 2) ("position" . (0 0))))JSON-RPC
{
"id": 1,
"jsonrpc": "2.0",
"method": "badbit/call",
"params": {
"arguments": {
"columns": 3,
"data_rows": 2,
"position": [
0,
0
]
},
"operation": "cad.annotate.table"
}
}Commands that do the same
Full schema
JSON Schema 2020-12.
Parameters (input)
{
"$defs": {
"RowKind": {
"oneOf": [
{
"const": "title",
"type": "string"
},
{
"const": "header",
"type": "string"
},
{
"const": "data",
"type": "string"
}
]
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"column_width": {
"default": null,
"description": "The column width, in drawing units.",
"format": "double",
"type": [
"number",
"null"
]
},
"columns": {
"default": null,
"description": "Number of columns.",
"format": "uint",
"maximum": 1000,
"minimum": 1,
"type": [
"integer",
"null"
]
},
"data_rows": {
"default": null,
"description": "How many data rows (the title and header come in addition).",
"format": "uint",
"maximum": 10000,
"minimum": 1,
"type": [
"integer",
"null"
]
},
"first_row": {
"anyOf": [
{
"$ref": "#/$defs/RowKind"
},
{
"type": "null"
}
],
"description": "The cell style of the first row: title, header or data."
},
"position": {
"description": "Position [x, y] of a point or of a text (the insertion point).",
"items": {
"format": "double",
"type": "number"
},
"maxItems": 2,
"minItems": 2,
"type": "array"
},
"row_contents": {
"default": null,
"description": "The table content, row by row [[text, …], …].",
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"maxItems": 10000,
"minItems": 1,
"type": [
"array",
"null"
]
},
"row_lines": {
"default": null,
"description": "The row height, in text lines.",
"format": "uint",
"maximum": 100,
"minimum": 1,
"type": [
"integer",
"null"
]
},
"second_row": {
"anyOf": [
{
"$ref": "#/$defs/RowKind"
},
{
"type": "null"
}
],
"description": "The cell style of the second row: title, header or data."
},
"table_style": {
"default": null,
"description": "The table style (it must exist).",
"type": [
"string",
"null"
]
}
},
"required": [
"position"
],
"type": "object"
}Result (output)
{
"$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"
}