Operaciones de BadBit CAD
cad.block.visibility_state
Crea, renombra, borra, ordena o elige estados de visibilidad de un bloque dinámico (BVSTATE, -BVSTATE).
- Programa: BadBit CAD
- Tipo de acción: Cambia el dibujo
- Modifica el dibujo
- Desde la versión 2027.0.0-beta.8
En el bloque name (con el parámetro de visibilidad), state_operation new crea state_name (que pasa a ser el estado del bloque; new_state_mode hide_all, show_all o keep_current, el predeterminado), rename cambia el nombre a new_state_name, delete lo borra (el último no sale), set_current lo vuelve el estado del bloque y move_up o move_down cambia el orden, como BVSTATE. El estado de cada inserción cambia con cad.block.dynamic_set. Un paso de deshacer. Devuelve lo que cambió.
Parámetros
| Nombre | Tipo | Obligatorio | Descripción |
|---|---|---|---|
name | string | Sí | Nombre (de la capa, de la variable de sistema o del comando, según la operación). |
new_state_mode | DynNewStateMode | null | No | Lo que muestra el estado nuevo: hide_all, show_all o keep_current (el predeterminado: como el estado actual). |
new_state_name | string | null | No | El nombre nuevo del estado. |
state_name | string | Sí | El nombre del estado de visibilidad (en new, el del estado nuevo). |
state_operation | DynStateOperation | Sí | Qué hacer con el estado: new, rename, delete, set_current, move_up o move_down. |
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": {
"name": "Door",
"new_state_mode": "show_all",
"state_name": "Closed",
"state_operation": "new"
},
"operation": "cad.block.visibility_state"
},
"name": "badbit_call_operation"
}
}Python
import badbit
result = badbit.cad.block.visibility_state(name="Door", new_state_mode="show_all", state_name="Closed", state_operation="new")LISP
(badbit-call "cad.block.visibility_state" '(("name" . "Door") ("new_state_mode" . "show_all") ("state_name" . "Closed") ("state_operation" . "new")))JSON-RPC
{
"id": 1,
"jsonrpc": "2.0",
"method": "badbit/call",
"params": {
"arguments": {
"name": "Door",
"new_state_mode": "show_all",
"state_name": "Closed",
"state_operation": "new"
},
"operation": "cad.block.visibility_state"
}
}Comandos que hacen lo mismo
Esquema completo
JSON Schema 2020-12, con las descripciones en inglés.
Parámetros (entrada)
{
"$defs": {
"DynNewStateMode": {
"oneOf": [
{
"const": "hide_all",
"type": "string"
},
{
"const": "show_all",
"type": "string"
},
{
"const": "keep_current",
"type": "string"
}
]
},
"DynStateOperation": {
"oneOf": [
{
"const": "new",
"type": "string"
},
{
"const": "rename",
"type": "string"
},
{
"const": "delete",
"type": "string"
},
{
"const": "set_current",
"type": "string"
},
{
"const": "move_up",
"type": "string"
},
{
"const": "move_down",
"type": "string"
}
]
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"name": {
"description": "Name (of the layer, of the system variable or of the command, depending on the operation).",
"type": "string"
},
"new_state_mode": {
"anyOf": [
{
"$ref": "#/$defs/DynNewStateMode"
},
{
"type": "null"
}
],
"description": "What the new state shows: hide_all, show_all or keep_current (the default: like the current state)."
},
"new_state_name": {
"default": null,
"description": "The new name of the state.",
"type": [
"string",
"null"
]
},
"state_name": {
"description": "The visibility state name (for new, the new state's).",
"type": "string"
},
"state_operation": {
"$ref": "#/$defs/DynStateOperation",
"description": "What to do with the state: new, rename, delete, set_current, move_up or move_down."
}
},
"required": [
"name",
"state_operation",
"state_name"
],
"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"
}