Operações do BadBit CAD
cad.format.dim_style
Cria ou muda um estilo de cota (DIMSTYLE).
- Programa: BadBit CAD
- Tipo de ação: Altera o desenho
- Altera o desenho
- Desde a versão 2027.0.0-beta.8
Cria o estilo de cota name (a partir de based_on ou do atual) ou muda o que existe, como a janela do DIMSTYLE e o -DIMSTYLE: variables são as variáveis de cota e os valores ({"DIMTXT": 2.5, "DIMASZ": 2}). As cotas que usam o estilo são redesenhadas. set_current torna o estilo o atual. Devolve se foi criado e quantas cotas mudaram.
Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
based_on | string | null | Não | O estilo de partida do estilo novo (sem ele, o atual). |
name | string | Sim | Nome (da camada, da variável de sistema ou do comando, conforme a operação). |
set_current | boolean | Não | Torna o estilo o atual. |
variables | object | Não | As variáveis de cota e os valores (DIMTXT, DIMASZ...). |
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
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 fazem o mesmo
Esquema completo
JSON Schema 2020-12, com as descrições em 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 (saída)
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"
}