Operaciones de BadBit CAD
cad.annotate.table
Crea una tabla (TABLE, -TABLE).
- Programa: BadBit CAD
- Tipo de acción: Cambia el dibujo
- Modifica el dibujo
- Desde la versión 2027.0.0-beta.8
Crea la tabla de TABLE con la esquina superior izquierda en position: con columns y data_rows (las filas de datos; el título y el encabezado van además, por los estilos de celda first_row y second_row), column_width y row_lines (la altura en líneas de texto); o con row_contents, el contenido fila a fila (como una tabla de CSV, la primera fila es el encabezado). table_style elige el estilo (sin él, el actual). Devuelve el identificador. En el papel (una presentación a la vista, fuera de las ventanas gráficas), las coordenadas y las medidas son en mm; los ángulos y los factores de escala no cambian.
Parámetros
| Nombre | Tipo | Obligatorio | Descripción |
|---|---|---|---|
column_width | number | null | No | La anchura de las columnas, en unidades del dibujo. |
columns | integer | null | No | Número de columnas. |
data_rows | integer | null | No | Cuántas filas de datos (el título y el encabezado van además). |
first_row | RowKind | null | No | El estilo de celda de la primera fila: title, header o data. |
position | array<number> | Sí | Posición [x, y] de un punto o de un texto (el punto de inserción). |
row_contents | array<array<string>> | null | No | El contenido de la tabla, fila a fila [[texto, …], …]. |
row_lines | integer | null | No | La altura de las filas, en líneas de texto. |
second_row | RowKind | null | No | El estilo de celda de la segunda fila: title, header o data. |
table_style | string | null | No | El estilo de tabla (tiene que existir). |
Errores
| Código | JSON-RPC | Qué significa |
|---|---|---|
invalid_params | -32602 | Los parámetros no siguen el esquema o una regla de la operación. |
not_found | -32001 | El objeto, la operación, el archivo o el nombre no existe. |
conflict | -32004 | El estado actual no lo permite ahora. |
failed | -32005 | La operación falló. |
Ejemplo
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"
}
}Comandos que hacen lo mismo
Esquema completo
JSON Schema 2020-12, con las descripciones en inglés.
Parámetros (entrada)
{
"$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"
}Resultado (salida)
{
"$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"
}