lib_add_footprint_text
Add text to a PcbLib footprint and its underlying board, then register the primitive so the placement editor displays it reliably.
Instructions
Add a text primitive to a PcbLib footprint.
Trap baked into this handler: in a PcbLib, adding a primitive
only to the footprint does NOT register it with the placement
editor -- the text shows up only after a save+reload. This
tool adds the text to BOTH the footprint and the underlying
board, then broadcasts PCBM_BoardRegisteration to both, which
is the pattern that registers the primitive reliably.
Args:
text: The string to place. Required.
x, y: Coordinates in mils, relative to the FOOTPRINT's origin,
which is what the handler has always actually done
(Footprint.X + MilsToCoord(x)). The old wording said
"board origin" and that was wrong: a PcbLib footprint sits
at Altium's library origin, 50000 mils out, so the two
readings differ by more than a metre. The pad, track and
arc tools wrote absolute board coordinates and produced
footprints whose geometry was nowhere near them; they now
match this one.
size: Text height in mils. 50 is a common silkscreen size;
drop to 30-40 for tight footprints.
width: Stroke width in mils. 8 reads cleanly at 50 mil
size; scale with size.
rotation: Rotation in degrees (0, 90, 180, 270 typical).
layer: Layer name resolved by GetLayerFromString
(TopOverlay, BottomOverlay, TopSolder,
BottomSolder, Mechanical1 ... Mechanical32).
use_ttfont: True for TrueType; default False is the
vector stroke font that fab houses prefer.
mirror: Mirror the text. Set this for anything on a BOTTOM
layer, or it reads backwards on the finished board;
audit_find_mirrored_pcb_text reports both halves of
the mistake (bottom text unmirrored, top text mirrored).
library_path: Optional .PcbLib to focus before adding.
Defaults to the active document.
component_name: Optional footprint name to switch to before
adding. Defaults to the currently active footprint.
units: "mil" (default) or "mm", for every length and
coordinate here, kept exact rather than rounded to
whole mils.
Returns:
Dict with success, footprint, text, layer,
x, y.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | ||
| y | No | ||
| size | No | ||
| text | Yes | ||
| layer | No | TopOverlay | |
| units | No | mil | |
| width | No | ||
| mirror | No | ||
| rotation | No | ||
| use_ttfont | No | ||
| library_path | No | ||
| component_name | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||