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

Operações do BadBit CAD

cad.inquiry.measure

Mede distância, raio, ângulo ou área (MEASUREGEOM).

  • Programa: BadBit CAD
  • Tipo de ação: Lê o desenho
  • Só leitura
  • Desde a versão 2027.0.0-beta.8

Como as opções do MEASUREGEOM: mode distance (points, como o cad.inquiry.dist), radius (o raio e o diâmetro do círculo, arco ou arco da polilinha id; near escolhe o arco da polilinha), angle (o ângulo pelo vertex e os dois points, ou o ângulo do arco id, em graus) ou area (points ou ids, como o cad.inquiry.area). Devolve value com a unidade. Só leitura. No papel de um layout, em mm (unit "mm", a área em mm²): os pontos pelo espaço à vista, os objetos pelo espaço deles.

Parâmetros

NomeTipoObrigatórioDescrição
idstring | nullNãoIdentificador do objeto (32 dígitos hexadecimais), ou identificador do comando na lista de comandos.
idsarray<string> | nullNãoIdentificadores de objetos (32 dígitos hexadecimais cada).
modeMeasureModeSimO modo: no zoom, extents, window, center, previous ou factor; na medida, distance, radius, angle ou area; no isolamento, isolate, hide ou end.
neararray<number> | nullNãoUm ponto [x, y] perto da parte que vale (na cota, perto da linha de chamada de onde a série sai).
pointsarray<array<number>> | nullNãoOs pontos [[x, y], …], na ordem: os vértices da polilinha (pelo menos 2), os pontos de ajuste ou de controle da spline.
vertexarray<number> | nullNãoO vértice (0 é o primeiro).

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.
failed-32005A operação falhou.

Exemplo

MCP

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "arguments": {
        "id": "0190f3a2b4c5d6e7f8091a2b3c4d5e6f",
        "mode": "radius"
      },
      "operation": "cad.inquiry.measure"
    },
    "name": "badbit_call_operation"
  }
}

Python

Python
import badbit

result = badbit.cad.inquiry.measure(id="0190f3a2b4c5d6e7f8091a2b3c4d5e6f", mode="radius")

LISP

LISP
(badbit-call "cad.inquiry.measure" '(("id" . "0190f3a2b4c5d6e7f8091a2b3c4d5e6f") ("mode" . "radius")))

JSON-RPC

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "badbit/call",
  "params": {
    "arguments": {
      "id": "0190f3a2b4c5d6e7f8091a2b3c4d5e6f",
      "mode": "radius"
    },
    "operation": "cad.inquiry.measure"
  }
}

Comandos que fazem o mesmo

MEASUREGEOM

Esquema completo

JSON Schema 2020-12, com as descrições em inglês.

Parâmetros (entrada)
JSON
{
  "$defs": {
    "MeasureMode": {
      "oneOf": [
        {
          "const": "distance",
          "type": "string"
        },
        {
          "const": "radius",
          "type": "string"
        },
        {
          "const": "angle",
          "type": "string"
        },
        {
          "const": "area",
          "type": "string"
        }
      ]
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "id": {
      "default": null,
      "description": "Object identifier (32 hexadecimal digits), or command identifier in the command list.",
      "type": [
        "string",
        "null"
      ]
    },
    "ids": {
      "default": null,
      "description": "Object identifiers (32 hexadecimal digits each).",
      "items": {
        "type": "string"
      },
      "maxItems": 200000,
      "minItems": 1,
      "type": [
        "array",
        "null"
      ]
    },
    "mode": {
      "$ref": "#/$defs/MeasureMode",
      "description": "The mode: in zoom, extents, window, center, previous or factor; in a measurement, distance, radius, angle or area; in isolation, isolate, hide or end."
    },
    "near": {
      "default": null,
      "description": "A point [x, y] near the part that counts (on a dimension, near the extension line the series starts from).",
      "items": {
        "format": "double",
        "type": "number"
      },
      "maxItems": 2,
      "minItems": 2,
      "type": [
        "array",
        "null"
      ]
    },
    "points": {
      "default": null,
      "description": "The points [[x, y], …], in order: the polyline vertices (at least 2), the fit or control points of the spline.",
      "items": {
        "items": {
          "format": "double",
          "type": "number"
        },
        "maxItems": 2,
        "minItems": 2,
        "type": "array"
      },
      "maxItems": 200000,
      "minItems": 2,
      "type": [
        "array",
        "null"
      ]
    },
    "vertex": {
      "default": null,
      "description": "The vertex (0 is the first).",
      "items": {
        "format": "double",
        "type": "number"
      },
      "maxItems": 2,
      "minItems": 2,
      "type": [
        "array",
        "null"
      ]
    }
  },
  "required": [
    "mode"
  ],
  "type": "object"
}
Resultado (saída)
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "diameter": {
      "description": "The diameter.",
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    },
    "mode": {
      "description": "The mode: in zoom, extents, window, center, previous or factor; in a measurement, distance, radius, angle or area; in isolation, isolate, hide or end.",
      "type": "string"
    },
    "perimeter": {
      "description": "The perimeter (for an open object, the length).",
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    },
    "unit": {
      "description": "The unit of the numbers (the drawing unit symbol; area in square units, angles in degrees).",
      "type": "string"
    },
    "value": {
      "description": "The value: of the system variable (text as typed in SETVAR, or a number), of the measurement, of the calculation or of the filter test (number, angle in degrees, color, lineweight in mm, object type or text with * and ?).",
      "format": "double",
      "type": "number"
    }
  },
  "required": [
    "mode",
    "value",
    "unit"
  ],
  "type": "object"
}
Buscar na documentação