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

Operações do BadBit CAD

cad.inquiry.massprop

Dá as propriedades de massa de regiões (MASSPROP).

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

Para cada região de ids: área, perímetro, caixa (bbox), centroide, momentos de inércia (inertia), produto de inércia (product), raios de giração (gyration) e momentos principais (principal: I, J e o ângulo de I em graus), como o MASSPROP. Os sólidos e regiões lidos de arquivo (kind solid) dão área, perímetro, volume, centroide e caixa. 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
idsarray<string>SimIdentificadores de objetos (32 dígitos hexadecimais cada).

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": {
        "ids": [
          "0190f3a2b4c5d6e7f8091a2b3c4d5e6f"
        ]
      },
      "operation": "cad.inquiry.massprop"
    },
    "name": "badbit_call_operation"
  }
}

Python

Python
import badbit

result = badbit.cad.inquiry.massprop(ids=["0190f3a2b4c5d6e7f8091a2b3c4d5e6f"])

LISP

LISP
(badbit-call "cad.inquiry.massprop" '(("ids" . ("0190f3a2b4c5d6e7f8091a2b3c4d5e6f"))))

JSON-RPC

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "badbit/call",
  "params": {
    "arguments": {
      "ids": [
        "0190f3a2b4c5d6e7f8091a2b3c4d5e6f"
      ]
    },
    "operation": "cad.inquiry.massprop"
  }
}

Comandos que fazem o mesmo

MASSPROP

Esquema completo

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

Parâmetros (entrada)
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "ids": {
      "description": "Object identifiers (32 hexadecimal digits each).",
      "items": {
        "type": "string"
      },
      "maxItems": 200000,
      "minItems": 1,
      "type": "array"
    }
  },
  "required": [
    "ids"
  ],
  "type": "object"
}
Resultado (saída)
JSON
{
  "$defs": {
    "MassItem": {
      "properties": {
        "area": {
          "description": "The area: in a measurement, the value (in square drawing units); in a capture, what becomes the image: view (what is on screen, the default), extents (everything drawn) or window.",
          "format": "double",
          "type": "number"
        },
        "bbox": {
          "description": "Bounding box [xmin, ymin, xmax, ymax], in drawing units.",
          "items": {
            "format": "double",
            "type": "number"
          },
          "maxItems": 4,
          "minItems": 4,
          "type": [
            "array",
            "null"
          ]
        },
        "centroid": {
          "description": "The centroid [x, y, z].",
          "items": {
            "format": "double",
            "type": "number"
          },
          "maxItems": 3,
          "minItems": 3,
          "type": [
            "array",
            "null"
          ]
        },
        "gyration": {
          "description": "The radii of gyration in X and Y.",
          "items": {
            "format": "double",
            "type": "number"
          },
          "maxItems": 2,
          "minItems": 2,
          "type": [
            "array",
            "null"
          ]
        },
        "id": {
          "description": "Object identifier (32 hexadecimal digits), or command identifier in the command list.",
          "type": "string"
        },
        "inertia": {
          "description": "The moments of inertia about the X and Y axes.",
          "items": {
            "format": "double",
            "type": "number"
          },
          "maxItems": 2,
          "minItems": 2,
          "type": [
            "array",
            "null"
          ]
        },
        "kind": {
          "description": "The kind: for a reference, xref (external reference), image or pdf; for a region, region or solid; for a dynamic property, the parameter type.",
          "type": "string"
        },
        "perimeter": {
          "description": "The perimeter (for an open object, the length).",
          "format": "double",
          "type": "number"
        },
        "principal": {
          "description": "The principal moments I and J and the angle of I in degrees.",
          "items": {
            "format": "double",
            "type": "number"
          },
          "maxItems": 3,
          "minItems": 3,
          "type": [
            "array",
            "null"
          ]
        },
        "product": {
          "description": "The product of inertia.",
          "format": "double",
          "type": [
            "number",
            "null"
          ]
        },
        "volume": {
          "description": "The volume.",
          "format": "double",
          "type": [
            "number",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "kind",
        "area",
        "perimeter"
      ],
      "type": "object"
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "items": {
      "description": "The items: the objects found, or the changes to make.",
      "items": {
        "$ref": "#/$defs/MassItem"
      },
      "type": "array"
    },
    "unit": {
      "description": "The unit of the numbers (the drawing unit symbol; area in square units, angles in degrees).",
      "type": "string"
    }
  },
  "required": [
    "items",
    "unit"
  ],
  "type": "object"
}
Buscar na documentação