Operações da suíte
suite.input.distance
Pede uma distância à pessoa, como o getdist do LISP.
- Programa: Todos os programas
- Tipo de ação: Lê o desenho
- Só leitura
- Desde a versão 2027.0.0-beta.6
Aceita a distância digitada ou dois pontos no desenho (o primeiro é base, se dado). Esc cancela o pedido.
Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
base | array<number> | null | Não | O ponto base [x, y] (nas perguntas à pessoa, a linha elástica sai dele até o cursor). |
message | string | null | Não | A pergunta mostrada na linha de comando. |
optional | boolean | Não | Aceitar o Enter sem resposta (o resultado vem vazio). |
Erros
| Código | JSON-RPC | O que significa |
|---|---|---|
cancelled | -32012 | Cancelado (Esc, desconexão ou fechamento). |
busy | -32006 | O BadBit está abrindo ou salvando um arquivo; tente de novo daqui a pouco. |
Exemplo
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"
}
}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": {
"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"
}Resultado (saída)
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"
}