Skip to content
BadBit Documentation
Sign in Download the beta

BadBit CAD operations

cad.format.mline_style

Creates or changes a multiline style (MLSTYLE).

  • Program: BadBit CAD
  • Type of action: Changes the drawing
  • Changes the drawing
  • Since version 2027.0.0-beta.8

Creates the multiline style name or changes the existing one, like the MLSTYLE dialog: style_description, elements (the lines, each with offset, color and linetype) and fill. set_current makes it the current style. Returns whether it was created.

Parameters

NameTypeRequiredDescription
elementsarray<MlineElement> | nullNoThe lines of the multiline style, each with offset, color and linetype.
fillboolean | nullNoFills between the lines.
namestringYesName (of the layer, of the system variable or of the command, depending on the operation).
set_currentbooleanNoMakes the style the current one.
style_descriptionstring | nullNoThe description of the style.

Errors

CodeJSON-RPCMeaning
invalid_params-32602The parameters do not follow the schema or a rule of the operation.
not_found-32001The object, operation, file or name does not exist.
conflict-32004The current state does not allow this now.
failed-32005The operation failed.

Example

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"
  }
}

Commands that do the same

MLSTYLE

Full schema

JSON Schema 2020-12.

Parameters (input)
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"
}
Result (output)
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"
}
Search the documentation