Operaciones de BadBit CAD
cad.format.dim_style
Crea o cambia un estilo de cota (DIMSTYLE).
- Programa: BadBit CAD
- Tipo de acción: Cambia el dibujo
- Modifica el dibujo
- Desde la versión 2027.0.0-beta.8
Crea el estilo de cota name (a partir de based_on o del actual) o cambia el que existe, como la ventana de DIMSTYLE y -DIMSTYLE: variables son las variables de cota y los valores ({"DIMTXT": 2.5, "DIMASZ": 2}). Las cotas que usan el estilo se redibujan. set_current lo vuelve el actual. Devuelve si se creó y cuántas cotas cambiaron.
Parámetros
| Nombre | Tipo | Obligatorio | Descripción |
|---|---|---|---|
based_on | string | null | No | El estilo de partida del estilo nuevo (sin él, el actual). |
name | string | Sí | Nombre (de la capa, de la variable de sistema o del comando, según la operación). |
set_current | boolean | No | Vuelve el estilo el actual. |
variables | object | No | Las variables de cota y los valores (DIMTXT, DIMASZ...). |
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
JSON
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"arguments": {
"based_on": "Standard",
"name": "Arq 1-50",
"set_current": true,
"variables": {
"DIMASZ": 2,
"DIMDEC": 2,
"DIMTXT": 2.5
}
},
"operation": "cad.format.dim_style"
},
"name": "badbit_call_operation"
}
}Python
Python
import badbit
result = badbit.cad.format.dim_style(based_on="Standard", name="Arq 1-50", set_current=True, variables={"DIMASZ": 2, "DIMDEC": 2, "DIMTXT": 2.5})LISP
LISP
(badbit-call "cad.format.dim_style" '(("based_on" . "Standard") ("name" . "Arq 1-50") ("set_current" . T) ("variables" . (("DIMASZ" . 2) ("DIMDEC" . 2) ("DIMTXT" . 2.5)))))JSON-RPC
JSON
{
"id": 1,
"jsonrpc": "2.0",
"method": "badbit/call",
"params": {
"arguments": {
"based_on": "Standard",
"name": "Arq 1-50",
"set_current": true,
"variables": {
"DIMASZ": 2,
"DIMDEC": 2,
"DIMTXT": 2.5
}
},
"operation": "cad.format.dim_style"
}
}Comandos que hacen lo mismo
Esquema completo
JSON Schema 2020-12, con las descripciones en inglés.
Parámetros (entrada)
JSON
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"based_on": {
"default": null,
"description": "The starting style of the new style (without it, the current one).",
"type": [
"string",
"null"
]
},
"name": {
"description": "Name (of the layer, of the system variable or of the command, depending on the operation).",
"maxLength": 255,
"minLength": 1,
"type": "string"
},
"set_current": {
"default": false,
"description": "Makes the style the current one.",
"type": "boolean"
},
"variables": {
"additionalProperties": true,
"default": {},
"description": "The dimension variables and values (DIMTXT, DIMASZ...).",
"type": "object"
}
},
"required": [
"name"
],
"type": "object"
}Resultado (salida)
JSON
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"is_current": {
"description": "It is (or became) the current one.",
"type": "boolean"
},
"style_created": {
"description": "The style was created now (otherwise it already existed and changed).",
"type": "boolean"
},
"updated_objects": {
"description": "How many objects using the style were redrawn.",
"format": "uint",
"minimum": 0,
"type": "integer"
}
},
"required": [
"style_created",
"updated_objects",
"is_current"
],
"type": "object"
}