BadBit CAD operations
cad.format.dim_style
Creates or changes a dimension style (DIMSTYLE).
- Program: BadBit CAD
- Type of action: Changes the drawing
- Changes the drawing
- Since version 2027.0.0-beta.8
Creates the dimension style name (from based_on or the current one) or changes the existing one, like the DIMSTYLE dialog and -DIMSTYLE: variables are the dimension variables and values ({"DIMTXT": 2.5, "DIMASZ": 2}). Dimensions using the style are redrawn. set_current makes it the current style. Returns whether it was created and how many dimensions changed.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
based_on | string | null | No | The starting style of the new style (without it, the current one). |
name | string | Yes | Name (of the layer, of the system variable or of the command, depending on the operation). |
set_current | boolean | No | Makes the style the current one. |
variables | object | No | The dimension variables and values (DIMTXT, DIMASZ...). |
Errors
| Code | JSON-RPC | Meaning |
|---|---|---|
invalid_params | -32602 | The parameters do not follow the schema or a rule of the operation. |
not_found | -32001 | The object, operation, file or name does not exist. |
conflict | -32004 | The current state does not allow this now. |
failed | -32005 | The operation failed. |
Example
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"
}
}Commands that do the same
Full schema
JSON Schema 2020-12.
Parameters (input)
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"
}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"
}