Pular para o conteúdo
BadBit Documentação
Entrar Baixar o beta

Operações do BadBit CAD

cad.format.scale_list

Põe e tira escalas da lista (SCALELISTEDIT).

  • Programa: BadBit CAD
  • Tipo de ação: Altera o desenho
  • Apaga
  • Desde a versão 2027.0.0-beta.8

Muda a lista de escalas do desenho, como o SCALELISTEDIT: reset volta à lista padrão, delete tira as escalas pelo nome, add põe as novas (name, paper, drawing). Devolve a lista nova.

Parâmetros

NomeTipoObrigatórioDescrição
addarray<ScaleItem>NãoOs itens a pôr.
deletearray<string>NãoOs nomes a tirar (na resposta, os que saíram).
resetbooleanNãoVolta à lista padrão antes do resto.

Erros

CódigoJSON-RPCO que significa
invalid_params-32602Os parâmetros não seguem o esquema ou uma regra da operação.
not_found-32001O objeto, a operação, o arquivo ou o nome não existe.
conflict-32004O estado atual não permite isso agora.
failed-32005A operação falhou.

Exemplo

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 fazem o mesmo

-SCALELISTEDITSCALELISTEDIT

Esquema completo

JSON Schema 2020-12, com as descrições em 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 (saída)
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 na documentação