Get Viewport Selection
selection_getRetrieve the entities pre-selected in the AutoCAD viewport to scope operations to the user's active selection instead of the entire drawing.
Instructions
Read the entities the user pre-selected in the AutoCAD viewport (COM backend only).
Returns the implied "pickfirst" selection — the entities highlighted with grips before invoking the AI — so work can be scoped to exactly those entities instead of the whole drawing. Typical use::
sel = selection_get()
dimension_auto(sel["handles"], style="chain")Result keys: ok — True on the COM backend (even for an empty selection) count — number of selected entities handles — list of entity handles (hex strings) to act on entities — full per-entity info (type, layer, color, ...) pickfirst — state of the PICKFIRST sysvar (None if unknown) message — guidance when nothing is selected
On the ezdxf headless backend there is no viewport, so this returns ok=False with an empty handles list.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||