Operações do BadBit CAD
cad.format.mline_style
Cria ou muda um estilo de multilinha (MLSTYLE).
- 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 multilinha name ou muda o que existe, como a janela do MLSTYLE: style_description, elements (as linhas, cada uma com offset, color e linetype) e fill. set_current torna o estilo o atual. Devolve se foi criado.
Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
elements | array<MlineElement> | null | Não | As linhas do estilo de multilinha, cada uma com offset, color e linetype. |
fill | boolean | null | Não | Preenche entre as linhas. |
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. |
style_description | string | null | Não | A descrição do estilo. |
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": {
"elements": [
{
"offset": 0.075
},
{
"offset": -0.075
}
],
"name": "Parede 15",
"set_current": true
},
"operation": "cad.format.mline_style"
},
"name": "badbit_call_operation"
}
}Python
Python
import badbit
result = badbit.cad.format.mline_style(elements=[{"offset": 0.075}, {"offset": -0.075}], name="Parede 15", set_current=True)LISP
LISP
(badbit-call "cad.format.mline_style" '(("elements" . ((("offset" . 0.075)) (("offset" . -0.075)))) ("name" . "Parede 15") ("set_current" . T)))JSON-RPC
JSON
{
"id": 1,
"jsonrpc": "2.0",
"method": "badbit/call",
"params": {
"arguments": {
"elements": [
{
"offset": 0.075
},
{
"offset": -0.075
}
],
"name": "Parede 15",
"set_current": true
},
"operation": "cad.format.mline_style"
}
}Comandos que fazem o mesmo
Esquema completo
JSON Schema 2020-12, com as descrições em inglês.
Parâmetros (entrada)
JSON
{
"$defs": {
"Color": {
"anyOf": [
{
"format": "uint8",
"maximum": 255,
"minimum": 0,
"type": "integer"
},
{
"type": "string"
}
]
},
"MlineElement": {
"additionalProperties": false,
"properties": {
"color": {
"anyOf": [
{
"$ref": "#/$defs/Color"
},
{
"type": "null"
}
],
"default": null,
"description": "Color: index 1 to 255 of the AutoCAD palette, bylayer, byblock, a name (red, yellow, green, cyan, blue, magenta, white) or #rrggbb."
},
"linetype": {
"default": null,
"description": "Linetype name (it must be loaded in the drawing), or bylayer.",
"type": [
"string",
"null"
]
},
"offset": {
"description": "The offset: in a multiline, from the axis (positive on one side, negative on the other); for copies, the displacement [dx, dy].",
"format": "double",
"type": "number"
}
},
"required": [
"offset"
],
"type": "object"
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"elements": {
"description": "The lines of the multiline style, each with offset, color and linetype.",
"items": {
"$ref": "#/$defs/MlineElement"
},
"maxItems": 16,
"minItems": 1,
"type": [
"array",
"null"
]
},
"fill": {
"default": null,
"description": "Fills between the lines.",
"type": [
"boolean",
"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"
},
"style_description": {
"default": null,
"description": "The description of the style.",
"maxLength": 255,
"type": [
"string",
"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"
}