Operações do BadBit CAD
cad.format.text_style
Cria ou muda um estilo de texto (STYLE).
- 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 texto name (a partir do atual) ou muda o que existe, como a janela do STYLE: font (o arquivo SHX ou TrueType), height (0: o TEXT pergunta), width_factor, oblique_angle (graus) e annotative. Os textos que usam o estilo são redesenhados. set_current torna o estilo o atual. Devolve se foi criado e quantos objetos mudaram.
Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
annotative | boolean | null | Não | O estilo é anotativo. |
font | string | null | Não | A fonte. |
height | number | null | Não | A altura do texto; no zoom, a altura visível; nas imagens, a altura em pixels; na vista nomeada, em unidades do desenho; na janela de vista, a altura do modelo que ela mostra, em unidades do desenho. |
name | string | Sim | Nome (da camada, da variável de sistema ou do comando, conforme a operação). |
oblique_angle | number | null | Não | A inclinação das letras, em graus (-85 a 85). |
set_current | boolean | Não | Torna o estilo o atual. |
width_factor | number | null | Não | O fator de largura das letras (1 é a fonte como ela é). |
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": {
"font": "arial.ttf",
"height": 0,
"name": "Notas",
"width_factor": 0.9
},
"operation": "cad.format.text_style"
},
"name": "badbit_call_operation"
}
}Python
Python
import badbit
result = badbit.cad.format.text_style(font="arial.ttf", height=0, name="Notas", width_factor=0.9)LISP
LISP
(badbit-call "cad.format.text_style" '(("font" . "arial.ttf") ("height" . 0) ("name" . "Notas") ("width_factor" . 0.9)))JSON-RPC
JSON
{
"id": 1,
"jsonrpc": "2.0",
"method": "badbit/call",
"params": {
"arguments": {
"font": "arial.ttf",
"height": 0,
"name": "Notas",
"width_factor": 0.9
},
"operation": "cad.format.text_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": {
"annotative": {
"default": null,
"description": "The style is annotative.",
"type": [
"boolean",
"null"
]
},
"font": {
"default": null,
"description": "The font.",
"type": [
"string",
"null"
]
},
"height": {
"default": null,
"description": "Text height; in zoom, the visible height; in images, the height in pixels; in a named view, in drawing units; in a layout viewport, the height of the model it shows, in drawing units.",
"format": "double",
"type": [
"number",
"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"
},
"oblique_angle": {
"default": null,
"description": "The obliquing angle of the letters, in degrees (-85 to 85).",
"format": "double",
"type": [
"number",
"null"
]
},
"set_current": {
"default": false,
"description": "Makes the style the current one.",
"type": "boolean"
},
"width_factor": {
"default": null,
"description": "The width factor of the letters (1 is the font as it is).",
"format": "double",
"type": [
"number",
"null"
]
}
},
"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"
}