2.3 KiB
2.3 KiB
PCB Selection Deep Dump
How to extract maximum data for current PCB selection using kicad-ipc-rs bindings.
Script
Use:
examples/selection_deep_dump.rs
Run:
RUSTFLAGS='-Awarnings' cargo run -q --features blocking --example selection_deep_dump
What It Collects
- Selection summary:
- total selected item count
- per-type counts (
type_url)
- Decoded selected items (
get_selection(Vec::new())) - Raw selected payload metadata (
get_selection_raw(Vec::new())) - Human-readable selection rows (
get_selection_details(Vec::new())) - Item IDs for all selected items
- Item bounding boxes (
get_item_bounding_boxes) - Footprint-level fields:
- reference
- UUID
- position (nm)
- orientation (deg)
- layer
- pad count
- Designator/value pairs from selection text (
get_selection_as_string().contents) - Selection text dump item IDs (
get_selection_as_string().ids) - Pad-level net rows for selected footprints (
get_pad_netlist) - Net graph among selected references (
net -> refs) - Net name to net code mapping (
get_nets)
API Sequence (Bindings)
KiCadClientBlocking::connectpingget_versionget_selection_summary(Vec::new())get_selection(Vec::new())get_selection_raw(Vec::new())get_selection_details(Vec::new())get_item_bounding_boxesget_selection_as_stringget_pad_netlistget_netsget_items_by_net(best path; may be unavailable)- fallback:
get_items_by_type_codesper type code + local net-name filter
Route/Trace Discovery Logic
Primary:
- Query
get_items_by_netwith types:KOT_PCB_TRACEKOT_PCB_VIAKOT_PCB_ARCKOT_PCB_ZONEKOT_PCB_PADKOT_PCB_SHAPE
Fallback when GetItemsByNet is unsupported:
- Query each type separately with
get_items_by_type_codes(vec![type_code]) - Filter returned items locally by
item.net.name in selected_net_names
Known KiCad 10.0.0-rc1 Behavior Seen
kiapi.board.commands.GetItemsByNetcan returnAS_UNHANDLED.- Script handles this and continues with fallback scan.
- On current session, fallback returned pad-connected items; no extra tracks/vias/arcs were returned for selected net names.
Notes
- Script is read-only.
- Retries are built in for transient API unhandled/timeouts.
- Output is verbose by design, intended for debugging and data mining.