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

Operaciones de BadBit CAD

cad.inquiry.massprop

Da las propiedades físicas de regiones (MASSPROP).

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

Para cada región de ids: área, perímetro, caja (bbox), centroide, momentos de inercia (inertia), producto de inercia (product), radios de giro (gyration) y momentos principales (principal: I, J y el ángulo de I en grados), como MASSPROP. Los sólidos y regiones leídos de archivo (kind solid) dan área, perímetro, volumen, centroide y caja. Solo lectura. En el papel de una presentación, en mm (unit "mm", el área en mm²): los puntos por el espacio a la vista, los objetos por su propio espacio.

Parámetros

NombreTipoObligatorioDescripción
idsarray<string>SíIdentificadores de objetos (32 dígitos hexadecimales cada uno).

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.
failed-32005La operación falló.

Ejemplo

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 hacen lo mismo

MASSPROP

Esquema completo

JSON Schema 2020-12, con las descripciones en 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 (salida)
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 en la documentación