pcb_run_drc
Run a Design Rule Check on the active PCB only when a human is available to dismiss Altium's modal dialog; otherwise read stored clearance violations to avoid blocking the bridge.
Instructions
Run Design Rule Check (DRC) on the active PCB. MODAL --
BLOCKS THE BRIDGE. Opt in with allow_modal=True.
DANGER: Altium has no non-interactive DRC trigger exposed to
DelphiScript. PCB:DesignRuleCheck raises the MODAL "Design
Rule Checker [mil]" setup dialog and the worker sits behind it
until a HUMAN clicks Cancel/OK. Nothing else on the bridge
runs meanwhile: one observed call left the loop dead for 30+
min, the client timed out at 1800 s, and every in-flight job
was stranded. No parameter suppresses the dialog, so this tool
refuses to fire unless the caller passes allow_modal=True,
which is a promise that a human is at the keyboard.
PREFER pcb_get_clearance_violations -- it reads the
violations already stored on the board, runs no DRC, and
cannot block.
PATHOLOGICAL CASE: a full DRC on a placed-but-unrouted board
(many components, zero tracks, everything unrouted) checks
every pad pair against every rule and is enormously slow for
an answer that is already known -- "nothing is routed yet".
Check pcb_get_board_statistics / pcb_get_unrouted_nets
first; if track count is 0, do not run DRC.
With allow_modal=True it executes the DRC and returns up
to 100 violations with full location data, so the agent can
jump straight to the offending spot instead of guessing from
the description.
drc_confirmed is true only when Altium rewrote the .DRC
report during this call. A cancelled dialog leaves the old
report untouched, so its count, 0 included, belongs to an
earlier run. It also stays false when the checker's Create
Report File option is off.
Per-violation shape:
name,description,rule: text from Altiumx_mils/y_mils/layer: violation's bbox centre (the "go here" hint)primitive1/primitive2: objects with{detail, type, net, layer, x_mils, y_mils}.typeis the object kind (Track / Pad / Via / Region / Comp);netis the net name. Two primitives are involved in most rule kinds (Clearance, Short Circuit); a single- primitive violation (e.g. AcuteAngle) leavesprimitive2with empty fields.
Use primitive1.net and primitive2.net to spot the
nets in conflict; use x_mils / y_mils to drive
proj_cross_probe or the dashboard's Drawing tab to the site.
Args: allow_modal: Must be True to actually run DRC, and it means "I accept that the bridge blocks on a modal dialog until a human clicks it". Default False refuses without touching Altium.
Returns:
Dict with violation_count (full count even if > 100),
drc_triggered, and violations array (first 100).
With allow_modal=False: {ok: False, reason: ...}
and no bridge call at all.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| allow_modal | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||