Skip to content
BadBit Documentation
Sign in Download the beta

BadBit CAD operations

cad.inquiry.massprop

Gives the mass properties of regions (MASSPROP).

  • Program: BadBit CAD
  • Type of action: Reads the drawing
  • Read only
  • Since version 2027.0.0-beta.8

For each region in ids: area, perimeter, bounding box (bbox), centroid, moments of inertia (inertia), product of inertia (product), radii of gyration (gyration) and principal moments (principal: I, J and the angle of I in degrees), like MASSPROP. Solids and regions read from a file (kind solid) give area, perimeter, volume, centroid and box. Read only. On a layout's paper, in mm (unit "mm", the area in mm²): the points by the space on screen, the objects by their own space.

Parameters

NameTypeRequiredDescription
idsarray<string>YesObject identifiers (32 hexadecimal digits each).

Errors

CodeJSON-RPCMeaning
invalid_params-32602The parameters do not follow the schema or a rule of the operation.
not_found-32001The object, operation, file or name does not exist.
failed-32005The operation failed.

Example

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"
  }
}

Commands that do the same

MASSPROP

Full schema

JSON Schema 2020-12.

Parameters (input)
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"
}
Result (output)
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"
}
Search the documentation