Operações do BadBit CAD
cad.annotate.table
Cria uma tabela (TABLE, -TABLE).
- Programa: BadBit CAD
- Tipo de ação: Altera o desenho
- Altera o desenho
- Desde a versão 2027.0.0-beta.8
Cria a tabela do TABLE com o canto de cima à esquerda em position: com columns e data_rows (as linhas de dados; o título e o cabeçalho vêm além delas, pelos estilos de célula first_row e second_row), column_width e row_lines (a altura em linhas de texto); ou com row_contents, o conteúdo linha a linha (como uma tabela vinda de CSV, a primeira linha é o cabeçalho). table_style escolhe o estilo (sem ele, o atual). Devolve o identificador. No papel (um layout à vista, fora das janelas de vista), as coordenadas e as medidas são em mm; os ângulos e os fatores de escala não mudam.
Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
column_width | number | null | Não | A largura das colunas, em unidades do desenho. |
columns | integer | null | Não | Número de colunas. |
data_rows | integer | null | Não | Quantas linhas de dados (o título e o cabeçalho vêm além delas). |
first_row | RowKind | null | Não | O estilo de célula da primeira linha: title, header ou data. |
position | array<number> | Sim | Posição [x, y] de um ponto ou de um texto (o ponto de inserção). |
row_contents | array<array<string>> | null | Não | O conteúdo da tabela, linha a linha [[texto, …], …]. |
row_lines | integer | null | Não | A altura das linhas, em linhas de texto. |
second_row | RowKind | null | Não | O estilo de célula da segunda linha: title, header ou data. |
table_style | string | null | Não | O estilo de tabela (tem de existir). |
Erros
| Código | JSON-RPC | O que significa |
|---|---|---|
invalid_params | -32602 | Os parâmetros não seguem o esquema ou uma regra da operação. |
not_found | -32001 | O objeto, a operação, o arquivo ou o nome não existe. |
conflict | -32004 | O estado atual não permite isso agora. |
failed | -32005 | A operação falhou. |
Exemplo
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 fazem o mesmo
Esquema completo
JSON Schema 2020-12, com as descrições em 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 (saída)
{
"$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"
}