Operaciones de BadBit CAD
cad.inquiry.measure
Mide distancia, radio, ángulo o área (MEASUREGEOM).
- Programa: BadBit CAD
- Tipo de acción: Lee el dibujo
- Solo lectura
- Desde la versión 2027.0.0-beta.8
Como las opciones de MEASUREGEOM: mode distance (points, como cad.inquiry.dist), radius (el radio y el diámetro del círculo, arco o arco de polilínea id; near elige el arco de la polilínea), angle (el ángulo en vertex entre los dos points, o el ángulo del arco id, en grados) o area (points o ids, como cad.inquiry.area). Devuelve value con la unidad. 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
| Nombre | Tipo | Obligatorio | Descripción |
|---|---|---|---|
id | string | null | No | Identificador del objeto (32 dígitos hexadecimales), o identificador del comando en la lista de comandos. |
ids | array<string> | null | No | Identificadores de objetos (32 dígitos hexadecimales cada uno). |
mode | MeasureMode | Sí | El modo: en el zoom, extents, window, center, previous o factor; en la medida, distance, radius, angle o area; en el aislamiento, isolate, hide o end. |
near | array<number> | null | No | Un punto [x, y] cerca de la parte que cuenta (en la cota, cerca de la línea de referencia de donde sale la serie). |
points | array<array<number>> | null | No | Los puntos [[x, y], …], en orden: los vértices de la polilínea (al menos 2), los puntos de ajuste o de control de la spline. |
vertex | array<number> | null | No | El vértice (0 es el primero). |
Errores
| Código | JSON-RPC | Qué significa |
|---|---|---|
invalid_params | -32602 | Los parámetros no siguen el esquema o una regla de la operación. |
not_found | -32001 | El objeto, la operación, el archivo o el nombre no existe. |
failed | -32005 | La operación falló. |
Ejemplo
MCP
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"arguments": {
"id": "0190f3a2b4c5d6e7f8091a2b3c4d5e6f",
"mode": "radius"
},
"operation": "cad.inquiry.measure"
},
"name": "badbit_call_operation"
}
}Python
import badbit
result = badbit.cad.inquiry.measure(id="0190f3a2b4c5d6e7f8091a2b3c4d5e6f", mode="radius")LISP
(badbit-call "cad.inquiry.measure" '(("id" . "0190f3a2b4c5d6e7f8091a2b3c4d5e6f") ("mode" . "radius")))JSON-RPC
{
"id": 1,
"jsonrpc": "2.0",
"method": "badbit/call",
"params": {
"arguments": {
"id": "0190f3a2b4c5d6e7f8091a2b3c4d5e6f",
"mode": "radius"
},
"operation": "cad.inquiry.measure"
}
}Comandos que hacen lo mismo
Esquema completo
JSON Schema 2020-12, con las descripciones en inglés.
Parámetros (entrada)
{
"$defs": {
"MeasureMode": {
"oneOf": [
{
"const": "distance",
"type": "string"
},
{
"const": "radius",
"type": "string"
},
{
"const": "angle",
"type": "string"
},
{
"const": "area",
"type": "string"
}
]
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"id": {
"default": null,
"description": "Object identifier (32 hexadecimal digits), or command identifier in the command list.",
"type": [
"string",
"null"
]
},
"ids": {
"default": null,
"description": "Object identifiers (32 hexadecimal digits each).",
"items": {
"type": "string"
},
"maxItems": 200000,
"minItems": 1,
"type": [
"array",
"null"
]
},
"mode": {
"$ref": "#/$defs/MeasureMode",
"description": "The mode: in zoom, extents, window, center, previous or factor; in a measurement, distance, radius, angle or area; in isolation, isolate, hide or end."
},
"near": {
"default": null,
"description": "A point [x, y] near the part that counts (on a dimension, near the extension line the series starts from).",
"items": {
"format": "double",
"type": "number"
},
"maxItems": 2,
"minItems": 2,
"type": [
"array",
"null"
]
},
"points": {
"default": null,
"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",
"null"
]
},
"vertex": {
"default": null,
"description": "The vertex (0 is the first).",
"items": {
"format": "double",
"type": "number"
},
"maxItems": 2,
"minItems": 2,
"type": [
"array",
"null"
]
}
},
"required": [
"mode"
],
"type": "object"
}Resultado (salida)
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"diameter": {
"description": "The diameter.",
"format": "double",
"type": [
"number",
"null"
]
},
"mode": {
"description": "The mode: in zoom, extents, window, center, previous or factor; in a measurement, distance, radius, angle or area; in isolation, isolate, hide or end.",
"type": "string"
},
"perimeter": {
"description": "The perimeter (for an open object, the length).",
"format": "double",
"type": [
"number",
"null"
]
},
"unit": {
"description": "The unit of the numbers (the drawing unit symbol; area in square units, angles in degrees).",
"type": "string"
},
"value": {
"description": "The value: of the system variable (text as typed in SETVAR, or a number), of the measurement, of the calculation or of the filter test (number, angle in degrees, color, lineweight in mm, object type or text with * and ?).",
"format": "double",
"type": "number"
}
},
"required": [
"mode",
"value",
"unit"
],
"type": "object"
}