Skip to content
BadBit Documentation
Sign in Download the beta

Suite operations

suite.input.distance

Asks the person for a distance, like getdist in LISP.

  • Program: All programs
  • Type of action: Reads the drawing
  • Read only
  • Since version 2027.0.0-beta.6

Accepts a typed distance or two points on the drawing (the first is base, when given). Esc cancels the request.

Parameters

NameTypeRequiredDescription
basearray<number> | nullNoThe base point [x, y] (in prompts to the person, the rubber-band line runs from it to the cursor).
messagestring | nullNoThe question shown on the command line.
optionalbooleanNoAccept Enter without an answer (the result comes back empty).

Errors

CodeJSON-RPCMeaning
cancelled-32012Cancelled (Esc, disconnection or closing).
busy-32006BadBit is busy opening or saving a file; try again shortly.

Example

MCP

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "arguments": {
        "base": [
          0,
          0
        ],
        "message": "Offset distance:"
      },
      "operation": "suite.input.distance"
    },
    "name": "badbit_call_operation"
  }
}

Python

Python
import badbit

result = badbit.suite.input.distance(base=[0, 0], message="Offset distance:")

LISP

LISP
(badbit-call "suite.input.distance" '(("base" . (0 0)) ("message" . "Offset distance:")))

JSON-RPC

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "badbit/call",
  "params": {
    "arguments": {
      "base": [
        0,
        0
      ],
      "message": "Offset distance:"
    },
    "operation": "suite.input.distance"
  }
}

Full schema

JSON Schema 2020-12.

Parameters (input)
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "base": {
      "default": null,
      "description": "The base point [x, y] (in prompts to the person, the rubber-band line runs from it to the cursor).",
      "items": {
        "format": "double",
        "type": "number"
      },
      "maxItems": 2,
      "minItems": 2,
      "type": [
        "array",
        "null"
      ]
    },
    "message": {
      "default": null,
      "description": "The question shown on the command line.",
      "maxLength": 500,
      "type": [
        "string",
        "null"
      ]
    },
    "optional": {
      "default": false,
      "description": "Accept Enter without an answer (the result comes back empty).",
      "type": "boolean"
    }
  },
  "type": "object"
}
Result (output)
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "distance": {
      "description": "The distance, in drawing units.",
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    }
  },
  "required": [
    "distance"
  ],
  "type": "object"
}
Search the documentation