Saltar al contenido
BadBit Documentación
Iniciar sesión Descargar la beta

Operaciones de BadBit CAD

cad.format.scale_list

Añade y quita escalas de la lista (SCALELISTEDIT).

  • Programa: BadBit CAD
  • Tipo de acción: Cambia el dibujo
  • Borra
  • Desde la versión 2027.0.0-beta.8

Cambia la lista de escalas del dibujo, como SCALELISTEDIT: reset vuelve a la lista por defecto, delete quita escalas por el nombre, add pone las nuevas (name, paper, drawing). Devuelve la lista nueva.

Parámetros

NombreTipoObligatorioDescripción
addarray<ScaleItem>NoLos elementos que se añaden.
deletearray<string>NoLos nombres que se quitan (en la respuesta, los que salieron).
resetbooleanNoVuelve a la lista por defecto antes del resto.

Errores

CódigoJSON-RPCQué significa
invalid_params-32602Los parámetros no siguen el esquema o una regla de la operación.
not_found-32001El objeto, la operación, el archivo o el nombre no existe.
conflict-32004El estado actual no lo permite ahora.
failed-32005La operación falló.

Ejemplo

MCP

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "arguments": {
        "add": [
          {
            "drawing": 33,
            "name": "1:33",
            "paper": 1
          }
        ]
      },
      "operation": "cad.format.scale_list"
    },
    "name": "badbit_call_operation"
  }
}

Python

Python
import badbit

result = badbit.cad.format.scale_list(add=[{"drawing": 33, "name": "1:33", "paper": 1}])

LISP

LISP
(badbit-call "cad.format.scale_list" '(("add" . ((("drawing" . 33) ("name" . "1:33") ("paper" . 1))))))

JSON-RPC

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "badbit/call",
  "params": {
    "arguments": {
      "add": [
        {
          "drawing": 33,
          "name": "1:33",
          "paper": 1
        }
      ]
    },
    "operation": "cad.format.scale_list"
  }
}

Comandos que hacen lo mismo

-SCALELISTEDITSCALELISTEDIT

Esquema completo

JSON Schema 2020-12, con las descripciones en inglés.

Parámetros (entrada)
JSON
{
  "$defs": {
    "ScaleItem": {
      "additionalProperties": false,
      "properties": {
        "drawing": {
          "description": "The drawing units.",
          "format": "double",
          "type": "number"
        },
        "name": {
          "description": "Name (of the layer, of the system variable or of the command, depending on the operation).",
          "maxLength": 255,
          "minLength": 1,
          "type": "string"
        },
        "paper": {
          "description": "The paper: its name or the paper units, depending on the operation.",
          "format": "double",
          "type": "number"
        }
      },
      "required": [
        "name",
        "paper",
        "drawing"
      ],
      "type": "object"
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "add": {
      "default": [],
      "description": "The items to add.",
      "items": {
        "$ref": "#/$defs/ScaleItem"
      },
      "maxItems": 1000,
      "type": "array"
    },
    "delete": {
      "default": [],
      "description": "The names to remove (in the reply, the ones removed).",
      "items": {
        "type": "string"
      },
      "maxItems": 1000,
      "type": "array"
    },
    "reset": {
      "default": false,
      "description": "Goes back to the default list before the rest.",
      "type": "boolean"
    }
  },
  "type": "object"
}
Resultado (salida)
JSON
{
  "$defs": {
    "ScaleItem": {
      "additionalProperties": false,
      "properties": {
        "drawing": {
          "description": "The drawing units.",
          "format": "double",
          "type": "number"
        },
        "name": {
          "description": "Name (of the layer, of the system variable or of the command, depending on the operation).",
          "maxLength": 255,
          "minLength": 1,
          "type": "string"
        },
        "paper": {
          "description": "The paper: its name or the paper units, depending on the operation.",
          "format": "double",
          "type": "number"
        }
      },
      "required": [
        "name",
        "paper",
        "drawing"
      ],
      "type": "object"
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "scales": {
      "description": "The scales, each with name, paper and drawing.",
      "items": {
        "$ref": "#/$defs/ScaleItem"
      },
      "type": "array"
    }
  },
  "required": [
    "scales"
  ],
  "type": "object"
}
Buscar en la documentación