Skip to content
BadBit Documentation
Sign in Download the beta

BadBit CAD operations

cad.inquiry.dist

Measures the distance, angle and deltas between points (DIST).

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

With two points, returns the distance, the angle in the XY plane (angle, in degrees, counterclockwise from X) and the deltas dx and dy, like DIST. With more points, distance is the sum of the distances from each point to the next (DIST Multiple points); the angle and deltas are still those of the first two. Numbers in drawing units (unit). 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
pointsarray<array<number>>YesThe points [[x, y], …], in order: the polyline vertices (at least 2), the fit or control points of the spline.

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": {
        "points": [
          [
            0,
            0
          ],
          [
            3,
            4
          ]
        ]
      },
      "operation": "cad.inquiry.dist"
    },
    "name": "badbit_call_operation"
  }
}

Python

Python
import badbit

result = badbit.cad.inquiry.dist(points=[[0, 0], [3, 4]])

LISP

LISP
(badbit-call "cad.inquiry.dist" '(("points" . ((0 0) (3 4)))))

JSON-RPC

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "badbit/call",
  "params": {
    "arguments": {
      "points": [
        [
          0,
          0
        ],
        [
          3,
          4
        ]
      ]
    },
    "operation": "cad.inquiry.dist"
  }
}

Commands that do the same

DIST

Full schema

JSON Schema 2020-12.

Parameters (input)
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "points": {
      "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"
    }
  },
  "required": [
    "points"
  ],
  "type": "object"
}
Result (output)
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "angle": {
      "description": "Angle in degrees, counterclockwise (in ROTATE the rotation; in ARRAY the grid angle; in CHAMFER the angle from the first line).",
      "format": "double",
      "type": "number"
    },
    "distance": {
      "description": "The distance, in drawing units.",
      "format": "double",
      "type": "number"
    },
    "dx": {
      "description": "The difference in X.",
      "format": "double",
      "type": "number"
    },
    "dy": {
      "description": "The difference in Y.",
      "format": "double",
      "type": "number"
    },
    "unit": {
      "description": "The unit of the numbers (the drawing unit symbol; area in square units, angles in degrees).",
      "type": "string"
    }
  },
  "required": [
    "distance",
    "angle",
    "dx",
    "dy",
    "unit"
  ],
  "type": "object"
}
Search the documentation