Operaciones de BadBit CAD
cad.format.mline_style
Crea o cambia un estilo de línea múltiple (MLSTYLE).
- 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 línea múltiple name o cambia el que existe, como la ventana de MLSTYLE: style_description, elements (las líneas, cada una con offset, color y linetype) y fill. set_current lo vuelve el actual. Devuelve si se creó.
Parámetros
| Nombre | Tipo | Obligatorio | Descripción |
|---|---|---|---|
elements | array<MlineElement> | null | No | Las líneas del estilo de línea múltiple, cada una con offset, color y linetype. |
fill | boolean | null | No | Rellena entre las líneas. |
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. |
style_description | string | null | No | La descripción del estilo. |
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": {
"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 hacen lo mismo
Esquema completo
JSON Schema 2020-12, con las descripciones en 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 (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"
}