CAD kit command

object.measure

Measure Entities

Measures without changing anything: each entity's bounding box (`bounds`: handles), the minimum distance between two entities or points with the nearest points (`distance`: [a, b], each a handle or [x, y]), the points where two entities cross (`intersections`: [a, b] handles), or the pairs of duplicate objects in a space (`overlaps`: {layout?}, Model unless named; OVERKILL's report, nothing deleted). Give exactly one.

Kit
CAD 0.1.0 (.dxf)
Changes the document
no

Parameters

Parameters of object.measure
NameTypeRequiredDescription
boundsstring[]noentities' handles
distance(string | number[])[]notwo entities (handles) or points ([x, y])
intersectionsstring[]notwo entities' handles
overlapsobjectnothe space to report duplicates in

Call through cad_run

text
cad_run {
  "path": "<file>.dxf",
  "steps": [{ "command": "object.measure" }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: bounds, distance, intersections, overlaps. cad_run answers the step’s result in completed[i].result.

Result

Result of object.measure
NameTypeRequiredDescription
boundsobject[]no
distancenumberno
fromnumber[]no
pairsobject[]no
pointsnumber[][]no
tonumber[]no
Result JSON Schema
json
{
  "additionalProperties": false,
  "properties": {
    "bounds": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "handle": {
            "type": "string"
          },
          "max": {
            "items": {
              "type": "number"
            },
            "type": "array"
          },
          "min": {
            "items": {
              "type": "number"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "distance": {
      "type": "number"
    },
    "from": {
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "pairs": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "a": {
            "type": "string"
          },
          "b": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "points": {
      "items": {
        "items": {
          "type": "number"
        },
        "type": "array"
      },
      "type": "array"
    },
    "to": {
      "items": {
        "type": "number"
      },
      "type": "array"
    }
  },
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "bounds": {
      "description": "entities' handles",
      "items": {
        "type": "string"
      },
      "type": "array",
      "x-khp-types": [
        "Entity"
      ]
    },
    "distance": {
      "description": "two entities (handles) or points ([x, y])",
      "items": {
        "oneOf": [
          {
            "description": "an entity's handle",
            "type": "string"
          },
          {
            "description": "a point [x, y]",
            "items": {
              "type": "number"
            },
            "type": "array"
          }
        ],
        "x-khp-role": "object",
        "x-khp-types": [
          "Entity"
        ]
      },
      "type": "array"
    },
    "intersections": {
      "description": "two entities' handles",
      "items": {
        "type": "string"
      },
      "type": "array",
      "x-khp-types": [
        "Entity"
      ]
    },
    "overlaps": {
      "additionalProperties": false,
      "description": "the space to report duplicates in",
      "properties": {
        "layout": {
          "description": "a layout's name, or \"Model\" (the default)",
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "returns": "bounds | {distance, from, to} | {points} | {pairs}",
  "type": "object"
}

Generated from the command list of @kition/[email protected] and the kit itself (cad_commands through @kition/[email protected], built from KitionAI/kition-cad@1ec542d). As data: commands.jsonl.