query_region
Retrieve shapes, text labels, and child instances overlapping a bounding box in a KLayout layout. Returns stable IDs for follow-up measurement, analysis, or rendering.
Instructions
Return shapes, text labels, and child instances overlapping a box.
Each returned shape has a session-stable id (e.g. shp_1a2b3c4d). Pass these ids to
measure_geometry, analyze_waveguide, or render_view annotations. Results are
sorted deterministically; truncation reports how many items the limits dropped.
Args:
session_id: Session returned by open_layout.
box: Query window in microns: {"left", "bottom", "right", "top"}.
cell: Cell to query. Defaults to the session's selected top cell.
layers: Optional [{"layer": int, "datatype": int}] filter. Defaults to all layers.
hierarchy_mode: top for shapes placed directly in the cell, or recursive /
flattened to include shapes from child cells transformed into the cell's
coordinates.
max_shapes: Maximum number of shapes to return.
max_instances: Maximum number of child instances to return.
max_texts: Maximum number of text labels to return.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| box | Yes | ||
| cell | No | ||
| layers | No | ||
| max_texts | No | ||
| max_shapes | No | ||
| session_id | Yes | ||
| max_instances | No | ||
| hierarchy_mode | No | recursive |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||