BadBit CAD operations
cad.inquiry.measure
Measures distance, radius, angle or area (MEASUREGEOM).
- Program: BadBit CAD
- Type of action: Reads the drawing
- Read only
- Since version 2027.0.0-beta.8
Like the MEASUREGEOM options: mode distance (points, like cad.inquiry.dist), radius (the radius and diameter of the circle, arc or polyline arc id; near picks the polyline arc), angle (the angle at vertex between the two points, or the angle of arc id, in degrees) or area (points or ids, like cad.inquiry.area). Returns value with the 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
| Name | Type | Required | Description |
|---|---|---|---|
id | string | null | No | Object identifier (32 hexadecimal digits), or command identifier in the command list. |
ids | array<string> | null | No | Object identifiers (32 hexadecimal digits each). |
mode | MeasureMode | Yes | 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 | array<number> | null | No | A point [x, y] near the part that counts (on a dimension, near the extension line the series starts from). |
points | array<array<number>> | null | No | The points [[x, y], …], in order: the polyline vertices (at least 2), the fit or control points of the spline. |
vertex | array<number> | null | No | The vertex (0 is the first). |
Errors
| Code | JSON-RPC | Meaning |
|---|---|---|
invalid_params | -32602 | The parameters do not follow the schema or a rule of the operation. |
not_found | -32001 | The object, operation, file or name does not exist. |
failed | -32005 | The operation failed. |
Example
MCP
JSON
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"arguments": {
"id": "0190f3a2b4c5d6e7f8091a2b3c4d5e6f",
"mode": "radius"
},
"operation": "cad.inquiry.measure"
},
"name": "badbit_call_operation"
}
}Python
Python
import badbit
result = badbit.cad.inquiry.measure(id="0190f3a2b4c5d6e7f8091a2b3c4d5e6f", mode="radius")LISP
LISP
(badbit-call "cad.inquiry.measure" '(("id" . "0190f3a2b4c5d6e7f8091a2b3c4d5e6f") ("mode" . "radius")))JSON-RPC
JSON
{
"id": 1,
"jsonrpc": "2.0",
"method": "badbit/call",
"params": {
"arguments": {
"id": "0190f3a2b4c5d6e7f8091a2b3c4d5e6f",
"mode": "radius"
},
"operation": "cad.inquiry.measure"
}
}Commands that do the same
Full schema
JSON Schema 2020-12.
Parameters (input)
JSON
{
"$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"
}Result (output)
JSON
{
"$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"
}