lib_create_footprint_from_package
Create a complete PcbLib footprint from a datasheet package drawing, with IPC-7351B lands, silkscreen, courtyard and height, then read the pads back to verify geometry.
Instructions
Create a COMPLETE footprint in the open PcbLib from a package drawing.
Takes the package as the datasheet draws it, not a pad list: the lands come from IPC-7351B (toe, heel and side fillets with the tolerance stack-up) for the family and density asked for. Writes the pads (rounded rectangles with their corner ratio, rotation, holes, slots, non-plated holes), paste windows over an exposed pad with the pad's own paste closed, silkscreen kept clear of the copper with a pin 1 dot, the body outline and a .Designator on the assembly layer, the courtyard, and the footprint height from the package's maximum A. Origin at the package centroid. Every length goes in millimetres, unrounded.
It then READS THE PADS BACK (lib_get_pad_geometry) and compares count, centres, sizes, rotation, shape, holes and any manual paste or mask expansion with what was sent, within one internal unit. A difference is a failure, not a warning.
DATASHEET DISCIPLINE: transcribe the package from the
manufacturer's drawing fetched in this conversation, each
dimension as min/nom/max with its page and figure, and name the
datasheet in source. The engine sizes lands from the
tolerances, so a nominal-only dimension gives a worse pattern and
says so in warnings.
Args:
package: the PackageSpec as an object (or its JSON text):
family (chip, melf, molded, sod, sot23, sot89, sot223,
dpak, soic, son, qfn, qfp, plcc, bga, lga, crystal2,
crystal4, dip, header, radial, axial, to220, to92,
connector, custom) and the dimensions it needs, each a
number, [min, max], [min, nom, max] or
{min, nom, max, cite}. Axes: two-row parts have their
rows LEFT and RIGHT, so lead_span_x is the tip to tip
span across them (JEDEC E) and body_y the body along
them (D); lead_length is the terminal along the span
(L), lead_width across it (b). Exposed pad:
ep_x/ep_y. source: {document, revision, page,
ref, url}.
name: footprint name; default the package's name, else a
generated one (e.g. SOIC-8-P1.27N).
density: L, N or M (least, nominal, most). Default: the
package's own, N unless it says otherwise.
description: appended to the generated description, which
already names the family, the standard, the density and
the source.
assembly_layer, courtyard_layer: mechanical layers for those
roles. Empty picks them BY ROLE from the library: the
layer whose kind is "Assembly Top" / "Courtyard Top",
else the one whose name says so (the same reading
lib_audit_footprint_policies uses). With neither, the
call refuses and lists the library's layers rather than
guessing a number.
drafting: overrides of the drafting rules, e.g.
{"silk_width": 0.15, "ep_paste_coverage": 0.6, "mask_expansion": 0.05}. A non-zero mask expansion is
written to every pad; at the default 1:1 the library's
design rule decides.
set_height: write the footprint height (package A max) with
the existing height setter.
Returns:
{ok, footprint, library_path, created, layers, readback, pads, courtyard_mm, warnings, notes, ipc, steps}. ok is
true only when every step succeeded and the readback matched.
A failure after the footprint was created says so: the
footprint exists and is incomplete.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | ||
| density | No | ||
| package | Yes | ||
| drafting | No | ||
| set_height | No | ||
| description | No | ||
| assembly_layer | No | ||
| courtyard_layer | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||