Operaciones de BadBit CAD
cad.block.lookup_table
Arma la tabla de consulta de una acción de consulta (BLOOKUPTABLE).
- Programa: BadBit CAD
- Tipo de acción: Cambia el dibujo
- Modifica el dibujo
- Desde la versión 2027.0.0-beta.8
Cambia la tabla de la acción de consulta dynamic_action del bloque name (sin ella, la única del bloque): lookup_inputs son los parámetros de entrada, lookup_outputs los de consulta (tipo lookup) y lookup_rows las filas (input_values comprobados con cada parámetro, output_values el texto de la lista); reverse_lookup, por columna de consulta, permite elegir la fila en la lista (predeterminado: solo lectura), como BLOOKUPTABLE. Un paso de deshacer. Devuelve lo que cambió.
Parámetros
| Nombre | Tipo | Obligatorio | Descripción |
|---|---|---|---|
dynamic_action | DynNodeRef | null | No | La acción del bloque dinámico: el node o el nombre. |
lookup_inputs | array<DynNodeRef> | Sí | Los parámetros de entrada de la tabla de consulta (el node o la etiqueta; en los resultados, el node). |
lookup_outputs | array<DynNodeRef> | Sí | Los parámetros de consulta (de tipo lookup) de la tabla. |
lookup_rows | array<DynLookupRow> | Sí | Las filas de la tabla de consulta, con input_values y output_values. |
name | string | Sí | Nombre (de la capa, de la variable de sistema o del comando, según la operación). |
reverse_lookup | array<boolean> | No | Por columna de consulta: permite elegir la fila en la lista (falso: solo lectura). |
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": {
"lookup_inputs": [
"Width"
],
"lookup_outputs": [
"Size"
],
"lookup_rows": [
{
"input_values": [
"700"
],
"output_values": [
"Small"
]
},
{
"input_values": [
"900"
],
"output_values": [
"Large"
]
}
],
"name": "Door"
},
"operation": "cad.block.lookup_table"
},
"name": "badbit_call_operation"
}
}Python
import badbit
result = badbit.cad.block.lookup_table(lookup_inputs=["Width"], lookup_outputs=["Size"], lookup_rows=[{"input_values": ["700"], "output_values": ["Small"]}, {"input_values": ["900"], "output_values": ["Large"]}], name="Door")LISP
(badbit-call "cad.block.lookup_table" '(("lookup_inputs" . ("Width")) ("lookup_outputs" . ("Size")) ("lookup_rows" . ((("input_values" . ("700")) ("output_values" . ("Small"))) (("input_values" . ("900")) ("output_values" . ("Large"))))) ("name" . "Door")))JSON-RPC
{
"id": 1,
"jsonrpc": "2.0",
"method": "badbit/call",
"params": {
"arguments": {
"lookup_inputs": [
"Width"
],
"lookup_outputs": [
"Size"
],
"lookup_rows": [
{
"input_values": [
"700"
],
"output_values": [
"Small"
]
},
{
"input_values": [
"900"
],
"output_values": [
"Large"
]
}
],
"name": "Door"
},
"operation": "cad.block.lookup_table"
}
}Comandos que hacen lo mismo
Esquema completo
JSON Schema 2020-12, con las descripciones en inglés.
Parámetros (entrada)
{
"$defs": {
"DynLookupRow": {
"additionalProperties": false,
"properties": {
"input_values": {
"description": "The row input values, one per input parameter.",
"items": {
"type": "string"
},
"maxItems": 100,
"type": "array"
},
"output_values": {
"description": "The row lookup values (the list text), one per lookup parameter.",
"items": {
"type": "string"
},
"maxItems": 100,
"type": "array"
}
},
"required": [
"input_values",
"output_values"
],
"type": "object"
},
"DynNodeRef": {
"anyOf": [
{
"format": "uint32",
"minimum": 0,
"type": "integer"
},
{
"type": "string"
}
]
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"dynamic_action": {
"anyOf": [
{
"$ref": "#/$defs/DynNodeRef"
},
{
"type": "null"
}
],
"description": "The dynamic block action: the node or the name."
},
"lookup_inputs": {
"description": "The lookup table input parameters (the node or the label; in results, the node).",
"items": {
"$ref": "#/$defs/DynNodeRef"
},
"maxItems": 100,
"type": "array"
},
"lookup_outputs": {
"description": "The lookup parameters (lookup type) of the table.",
"items": {
"$ref": "#/$defs/DynNodeRef"
},
"maxItems": 100,
"minItems": 1,
"type": "array"
},
"lookup_rows": {
"description": "The lookup table rows, with input_values and output_values.",
"items": {
"$ref": "#/$defs/DynLookupRow"
},
"maxItems": 10000,
"type": "array"
},
"name": {
"description": "Name (of the layer, of the system variable or of the command, depending on the operation).",
"type": "string"
},
"reverse_lookup": {
"default": [],
"description": "Per lookup column: allows choosing the row from the list (false: read only).",
"items": {
"type": "boolean"
},
"maxItems": 100,
"type": "array"
}
},
"required": [
"name",
"lookup_inputs",
"lookup_outputs",
"lookup_rows"
],
"type": "object"
}Resultado (salida)
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"created": {
"description": "Identifiers of the objects created.",
"items": {
"type": "string"
},
"type": "array"
},
"deleted": {
"description": "The identifiers of what was deleted.",
"items": {
"type": "string"
},
"type": "array"
},
"document_changed": {
"description": "The drawing on screen is another one (opened, closed or changed tab): the lists of changes do not apply.",
"type": "boolean"
},
"inserts_changed": {
"description": "How many inserts of the block changed.",
"format": "uint",
"minimum": 0,
"type": "integer"
},
"modified": {
"description": "Whether there are unsaved changes; in results of changes, the identifiers of the objects changed.",
"items": {
"type": "string"
},
"type": "array"
},
"node": {
"description": "The node number of the parameter or action (what the other dynamic block operations use).",
"format": "uint32",
"minimum": 0,
"type": [
"integer",
"null"
]
},
"skipped_locked": {
"description": "Objects left as they were because they are on locked layers.",
"format": "uint",
"minimum": 0,
"type": "integer"
},
"truncated": {
"description": "The lists were cut at the limit.",
"type": "boolean"
}
},
"required": [
"inserts_changed",
"created",
"modified",
"deleted",
"document_changed",
"truncated"
],
"type": "object"
}