lib_fix_designators
Aligns every footprint's designator to the library's own convention for layer, height and pad-centred position, planning changes first as a dry run and applying them iteratively until converged.
Instructions
Bring every footprint's .Designator onto the library's OWN
convention: the layer, height and centring the majority already use.
Nothing is hard-coded. The target layer, its raw ordinal, the norm
height and the centring tolerance are all inferred from this library
(see lib_audit_footprint_policies); policy overrides any of
them. "Centred" means on the AVERAGE PAD CENTRE, not the library
origin.
DEFAULTS TO A DRY RUN. With dry_run=True (the default) it reports
exactly which footprints it would touch, on which layer, and at which
coordinates, and writes nothing. Pass dry_run=False to apply.
Applying RUNS TO CONVERGENCE: apply, save, reload the PcbLib, re-plan, repeat until nothing is left. The reload is mandatory, not cosmetic: Altium caches each text's bounding rectangle at load and never refreshes it when the text moves or is resized, so a second pass without a reload would centre against stale geometry and shove designators off the part. Resizing a text also changes its box, so height fixes and centring settle over successive passes rather than one.
PARTIAL SUCCESS IS EXPECTED AND REPORTED, NOT HIDDEN. A small number of
designators (a handful per library) do not persist a position change
through Altium's save for reasons not yet diagnosed: the write reads
back changed but the value reverts on reload. Rather than loop forever or
claim success, the tool stops when a pass makes no progress and returns
converged: false with the offending footprints in unrepairable
for a human to centre by hand. Everything else is applied. applied
counts only writes confirmed by read-back, never attempts.
Args:
library_path: .PcbLib to fix; defaults to the focused library.
dry_run: report the plan without writing (default True).
fix_layer: move designators off the convention layer onto it.
fix_center: re-centre designators beyond the library's tolerance.
fix_height: also normalise text height to the library norm.
add_missing: create a .Designator on footprints that lack one.
policy: explicit conventions, e.g.
{"designator_center_tol": 50, "designator_height": 20}.
Returns {library_path, dry_run, conventions, planned, applied, created, passes, converged, failed, skipped, actions}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| policy | No | ||
| dry_run | No | ||
| fix_layer | No | ||
| fix_center | No | ||
| fix_height | No | ||
| add_missing | No | ||
| library_path | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||