CAD kit command

object.query

Query Entities

Answers a page of objects of one space (Model, or a layout by `layout`, without going there; default the space shown) filtered by type, layer and a crossing or inside window, with their handles, properties and geometry and the total count.

Kit
CAD 0.1.0 (.dxf)
Changes the document
no

Parameters

Parameters of object.query
NameTypeRequiredDescription
crossingbooleannodefault true; false = entirely inside
layerstringnoa layer name
layoutstringno"Model" or a layout's name; default the space shown
limitintegerno
offsetnumberno
typestringno
windownumber[][]no

Call through cad_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: crossing, layer, layout, limit, offset, type, window. cad_run answers the step’s result in completed[i].result.

Result

Result of object.query
NameTypeRequiredDescription
countnumberno
entitiesobject[]no
offsetnumberno
returnednumberno
Result JSON Schema
json
{
  "additionalProperties": true,
  "properties": {
    "count": {
      "type": "number"
    },
    "entities": {
      "items": {
        "additionalProperties": true,
        "properties": {
          "color": {
            "type": "string"
          },
          "geometry": {
            "additionalProperties": true,
            "type": "object"
          },
          "handle": {
            "type": "string"
          },
          "layer": {
            "type": "string"
          },
          "transparency": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "offset": {
      "type": "number"
    },
    "returned": {
      "type": "number"
    }
  },
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "crossing": {
      "description": "default true; false = entirely inside",
      "type": "boolean"
    },
    "layer": {
      "description": "a layer name",
      "type": "string"
    },
    "layout": {
      "description": "\"Model\" or a layout's name; default the space shown",
      "type": "string"
    },
    "limit": {
      "type": "integer"
    },
    "offset": {
      "type": "number"
    },
    "type": {
      "type": "string"
    },
    "window": {
      "items": {
        "items": {
          "type": "number"
        },
        "type": "array"
      },
      "type": "array"
    }
  },
  "returns": "{count (all matches), returned, offset, entities}",
  "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.