lib_audit_footprint_policies
Audit a PcbLib for footprints that break library conventions on layers, pads, courtyards, silkscreen, 3D models, and designators, reporting expected versus actual values for each deviation.
Instructions
Sweep a PcbLib and flag footprints that break the library's own conventions: inconsistent layer usage, pad rules, pin-1 markings, courtyard, silkscreen, 3D models, designator style.
For each policy dimension it learns the library's DOMINANT convention
across all footprints and reports every footprint that deviates (so it
works on any house style without hard-coded rules). Pass policy to
pin a dimension to a required value instead, e.g.
{"silk_layer": "Top Overlay", "courtyard": true}.
Each finding names the footprint, the dimension, and the expected vs actual value: enough to drive a fix, not just a report.
Designators are checked for presence, layer, height, and for sitting on
the footprint's AVERAGE PAD CENTRE rather than the library origin (which
is arbitrary). Tune the centring window with
policy={"designator_center_tol": <mils>}.
Geometry is read with the bulk library.get_library_geometry
command, which walks the library once and pages the result. A library
of ~1000 footprints is one pass and a handful of round trips rather
than one round trip (and one full library re-scan) per footprint.
Args: library_path: Optional .PcbLib to focus first; defaults to the focused library. policy: Optional explicit conventions to enforce; omitted dimensions are inferred from the library.
Returns {library_path, footprint_count, conventions, findings, summary}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| policy | No | ||
| library_path | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||