Footprint review¶
A footprint checked once against its datasheet should not have to be checked again on the next board, unless it changed. berc fp keeps that record as a footprint review in the part source: the footprint by its review hash, and the parts it fits, each by its MPN or a whole family by its MPN's decoding (a review of an 0402 resistor footprint against Yageo's RC series datasheet covers every RC0402 resistor). What a review signs is the library footprint: a board copy's own edits are reported, never signed. The parts snapshot (parts.lock.toml) holds, for each library footprint hash and each MPN placed with it, the reviews that cover the pair, so a check runs offline. Nothing is stored on the symbols.
berc fp hash prints a footprint's review hash, fp1: and 16 hex digits:
berc fp hash Lib.pretty/SOT-23.kicad_mod # a library footprint
berc fp hash board.kicad_pcb U3 # a footprint on a board, by its reference
berc fp hash board.kicad_pcb U3 --canonical # and the text the hash is taken over
The hash covers what a review checks against the datasheet:
- every pad: number, type, shape, size, position, rotation, drill and its offset, layers, mask, paste, clearance and thermal settings, corner and chamfer ratios, custom pad shapes;
- the footprint's clearance, mask and paste settings;
- graphics on copper, mask, paste, courtyard and
Edge.Cutslayers, zones and keepouts.
Silk, fab and user layers, texts, the 3D model and where the footprint sits on a board don't count. A board copy is brought back to the footprint's own frame first (position, rotation and a flip to the back undone), so it has the hash of its library file. Lengths are compared on a 100 nm grid and items in a fixed order, so a re-save in another KiCad version or a reorder never changes the hash. The fp1: prefix is the version of these rules: a later change of them gives fp2: hashes, and an fp1: hash then reads as made by another version instead of as a mismatch. The hex digits are the first 8 bytes of the SHA-256 of the canonical text (--canonical, lines joined by a newline): a short fingerprint to tell a footprint unchanged, not a signature.
Once a footprint is reviewed, berc fp accept records the review (see Accepting a review), or the app's Accept does. berc fp check then checks a board against its parts snapshot:
Each board footprint is reviewed as the library footprint it names, found through --footprints and the fp-lib-table (a board footprint without a library nickname by its symbol's Footprint field), and each MPN of its part (its Mpn1, MPN_2, ... fields in every variant it is fitted in) is one pair with that library footprint's hash. A footprint whose library file is not found is reviewed as placed, its board copy's own edits included, and says so (reviewed as placed, "reviewed_as": "placed" in JSON). A footprint is ok when a review of its hash now covers every one of its pairs. Each footprint is one of:
| Status | Meaning |
|---|---|
| ok | a review of the footprint's hash covers every MPN of its part |
| changed | an MPN is covered only by a review of another hash: the footprint differs from the one reviewed, review it again |
| other version | an MPN is covered only by reviews of another version of the review hash (fp2: against fp1:) |
| not in lock | the parts snapshot lacks a pair: run berc parts refresh |
| partial | some MPNs covered, others not yet, named |
| uncovered | no MPN covered |
| no MPN | the part has no MPN to review the footprint against |
| no symbol | the footprint has no schematic symbol and is not marked board-only |
| not fitted | the part is fitted in no variant: nothing to review, not a failure |
| board-only | no symbol, marked board-only in KiCad (logos, mounting holes): listed last under its own heading, not a failure |
A board copy that differs from its library footprint is its own finding, apart from the review: the board was not updated from the library, or the copy overrides a setting of it. The line names what differs, from the canonical texts: each setting the footprint or a pad holds itself (paste on pad 1: library none, board -0.05, mask and paste margins and ratios, clearance, thermal relief, zone connection), grouped over the pads with the same change, then how many pads, graphics and zones differ beyond their settings. The board setup's mask and paste margins for pads that set none apply to every footprint alike: they are no footprint's difference, and the board's are said once below the list. --format json gives the board copy's hash (board_hash) and the differences (differences).
A board footprint placed under a different Lib:Name than its symbol's own Footprint field (a library migration half done, or a deliberate per-instance override) is reported too, naming both: a library migration that renamed or moved a footprint library, left half done, or a board edited by hand without updating the schematic, looks exactly like this. A footprint placed with no library nickname at all is not an override, there being nothing to compare its name against. Footprints that could not be compared are summed up once per reason below the list. --symbols DIR adds symbol libraries (a .kicad_sym, a .kicad_symdir or a folder of them, each named by its file name) searched before the sym-lib-table, and --footprints DIR footprint libraries searched before the fp-lib-table, for a PC without KiCad's global tables:
--details prints each MPN under its footprint with the reviews that cover it, or the review of another hash it was reviewed as. Without a parts snapshot the command exits 2, naming berc parts refresh. The exit code is 0 when every footprint is ok, not fitted or board-only and every copy up to date, 1 otherwise, 2 when the project or the snapshot can't be read.
Where a review was made¶
A review is made against one datasheet, and records where, so the review can be looked at again:
| Field | What |
|---|---|
hash, footprint |
the footprint's review hash and its Lib:Name |
covers |
what it covers: MPNs, each alone, or families, each a decoding scheme and the package segments (case_eia, package) its parts share |
doc, doc_rev |
the document number and revision, where the document library knows them: they survive a download of the same document with other bytes |
pdf_blake3 |
the PDF by the document library's content hash |
page |
the page the land pattern is on, 1-based |
scale |
the drawing's scale on that page, mm per PDF point |
at |
where the footprint lay on the page: its origin in page points from the page's top left, its rotation in degrees, mirror when seen from below |
reviewer, reviewed_on, note |
who reviewed it, the day, a note |
retracted |
set when the review was withdrawn (who, when, why): a retracted review covers nothing |
A review is never edited or deleted: a new one is recorded, and a wrong one is retracted. The parts snapshot holds the reviews its pairs name, so its git diff after a refresh shows a new or a retracted review.
What to review for a board¶
berc fp todo lists what a board's footprints need reviewed: one line per library footprint hash (the board copy's where no library file is found), and under it one line per family (where the MPNs decode into one) or MPN alone, with the references each stands for. One review of the footprint against a datasheet covers every family and MPN that datasheet covers. When the parts of its MPNs differ in some fact of the parts snapshot, the footprint's line is followed by the facts they differ in.
berc fp todo # the KiCad project in this directory
berc fp todo hw/board --symbols ~/kicad-library/symbols --footprints ~/kicad-library/footprints
berc fp todo hw/board --format json
The footprints to review come first, in the order to step through them: changed (reviewed before, the footprint moved on, naming the review it was reviewed as), other version, uncovered, by footprint's worst status; under each its families and MPNs. Each footprint line shows its Lib:Name, hash and how many of its families and MPNs are to review; each line under it the family or MPN, its MPNs and references, and (always shown, whatever the line's own status) the references whose board places a different footprint than their symbol's own Footprint, the same Lib:Name mismatch berc fp check names. Below them, under their own heading, the footprints that can't be reviewed until fixed: not in lock (refresh the snapshot), unknown MPN (the part source has no part of it: add it there first) and no MPN. The reviewed families and MPNs are counted; --all lists them too. --format json always holds every entry (one per footprint hash and family or MPN) with its hash, cover, MPNs, references, the reviews that cover it (covered_by) or that it was reviewed as (other), the symbol's Datasheet field, the library footprint file and its hash now (library_hash, another than hash when the board was not updated from the library), and reviews, every review an entry names; the library call is better_erc::fp::todo. files lists every file the list was made from (what the app's review tab watches). The exit code is 0 when there is nothing to review or fix, 1 otherwise, 2 when the project or the snapshot can't be read.
Accepting a review¶
berc fp accept records a review of board footprints in a part source, then refreshes the project's parts snapshot from it:
berc fp accept hw/board R1 R7 --from parts.toml --doc RC_Series@rev12 --page 4
berc fp accept hw/board U3 --from parts.toml --mpn TPS62840DLCR --dry-run
berc fp accept --hash fp1:0123456789abcdef --footprint-id Resistor_SMD:R_0402 --family-of RC0402FR-0710KL --from parts.toml
berc fp accept hw/board U1 --from parts.toml --footprint VHRD_Package_QFP:LQFP-48 # also sets the symbol's own Footprint
The references must share one review hash: one review is of one footprint. By default the review covers every MPN of their parts, each by its family where its MPN decodes into one (the same family berc fp todo lists), else alone; an MPN the source has no part of and that decodes into no family is left out, named. --mpn MPN covers that MPN alone and --family-of MPN its family, both repeatable, in place of the default. --hash with --footprint-id reviews a footprint by its hash instead, a library footprint before a board uses it (as berc fp hash prints it); it needs --mpn or --family-of, and no snapshot is refreshed.
--doc NO@REV, --pdf b3:HEX, --page, --by (else the login name) and --note say where the review was made (see Where a review was made); the day is today's. --dry-run says what would be recorded and records nothing.
--from FILE is the part source: a file in the snapshot's own shape, whose [[review]] list the review is added to. Without it, a berc built with the mx3 feature records the review in the mx3 part store (fp/review/accept), found as for berc parts refresh, and refreshes the snapshot from there.
--footprint LIB:NAME also sets the library symbol's own Footprint field to it, the value berc fp check showed as the one the board places: written into the library's .kicad_sym (or the symbol's file in a .kicad_symdir), found through the project's or the global sym-lib-table, and the copy of the symbol in every schematic sheet's lib_symbols. Only the field is written; every other byte of each file stays as it was. KiCad 8, 9 and 10 files are written; an older file is refused until KiCad 8 or newer saved it. The sym-lib-table lookup follows the library wherever it actually lives, even for a project copied somewhere else: to try it without touching the library in place, copy the library too and point the copied project's sym-lib-table at that copy.
Nothing is recorded when anything is wrong: references whose footprints differ, a footprint without a schematic symbol, a part without an MPN, an MPN to cover that no reference carries, a family asked of an MPN that decodes into none, a hash that is not fp1: and 16 hex digits. The exit code is 0 when recorded (or a dry run), 2 otherwise. --format json holds the covers, the MPNs left out, the review as the source stored it and the snapshot refreshed.
Checking a symbol library¶
berc fp check --lib checks a symbol library itself, before any board uses it: each symbol that names its MPNs, the hash of the library footprint its Footprint field names paired with each MPN, judged against the reviews a part source holds.
berc fp check --lib symbols/Lib.kicad_symdir --footprints footprints --from parts.toml
berc fp check --lib symbols --footprints footprints --from parts.toml # every library in the folder
berc fp check --lib Device hw/board --from parts.toml # a nickname from a sym-lib-table
--lib takes a .kicad_sym file, a KiCad 9+ .kicad_symdir directory, a folder of them, or a nickname from the sym-lib-table; it can be given more than once. A library given as a path is named by its file name (Lib.kicad_symdir is Lib). The footprints are found through --footprints (a .pretty directory or a folder of them, each named by its folder name, searched first), then the project's and the global fp-lib-table; the project is the directory given, . by default. Each symbol is one of:
| Status | Meaning |
|---|---|
| ok | a review of the footprint's hash covers every MPN of the symbol |
| changed | an MPN is covered only by a review of another hash: the footprint differs from the one reviewed |
| other version | an MPN is covered only by reviews of another version of the review hash |
| partial | some MPNs covered, others not yet |
| uncovered | no MPN covered |
| missing | the footprint the symbol names is not found; the line says why |
| unjudged | no --from: the footprint is read and hashed, the MPNs not judged |
| no MPN | a footprint but no MPN: a generic symbol, reviewed on each board with the MPNs its instances carry; not a failure |
| no footprint | the symbol sets no footprint (a generic part, a power symbol): listed last, not a failure |
A derived symbol (extends) has its parent's fields unless it sets its own. The exit code is 0 when every symbol is ok, has no MPN or no footprint, 1 otherwise, 2 when a library or the part source can't be read.
--allow NICKNAME (repeatable, for --lib here and for berc fp todo) lists the library nicknames a symbol and its footprint may be in: an exact name, or a prefix ending * (--allow 'VHRD_*'). A symbol's own library, or the one its Footprint names, that is none of them is reported, naming it. Given none, there is no rule and nothing is reported: a project only sets this once it has a library convention to enforce.
3D models against the footprint¶
berc fp model reads each footprint's 3D models (STEP) and measures them against the footprint: the third source of truth beside the datasheet drawing and the footprint itself.
berc fp model hw/board # every footprint on the project's board
berc fp model hw/board U3 J1 --details # these references, each pad's share under a lead
berc fp model ~/kicad-library/footprints/VHRD_Package_SO.pretty # every footprint of a library
berc fp model Lib.pretty/SOT-23.kicad_mod --format json
Each (model ...) entry's file is found as KiCad finds it: ${VAR} from the environment, KiCad's kicad_common.json, KIPRJMOD (the board's directory, or the directory a library is in; --project DIR sets it) and a stock KiCad's KICADn_3DMODEL_DIR; a .wrl tries .step and .stp beside it. The file is read (erc_step) and placed as KiCad places it: the scale, then the rotation about x, y and z (each by the negated angle), then the offset; a test holds this against kicad-cli pcb export step. For each model the command prints:
- the file and the variables that found it, or why it was not found;
- the file's unit, its parts and faces, and what the reader could not read (
--detailslists every warning); - the extents in x, y and z, the height above the board and the depth below it (THT leads);
- the middle of the model against the middle of the pads;
- how far the model reaches out of the courtyard;
- whether the leads land on the pads: the model's bottom 0.2 mm seen from below against each pad's copper, how many pads have a lead over them and how much of the slice is off the pads (
--details: each pad's share).
Coordinates are KiCad's 3D frame of the footprint in mm: x right, y up (the footprint editor's y negated, as the model offset is written), z up from the board surface. The findings are catalogue checks: LIB-22 model file missing or unreadable, LIB-23 out of the courtyard, LIB-24 a pad without a lead, LIB-25 scaled, LIB-26 not in mm, LIB-27 turned by an angle that is not a multiple of 90°, LIB-28 no model shown (berc explain LIB-24). The exit code is 1 on any warning, 0 when there are only suggestions (no model, not in mm) or nothing, 2 on a read error.
Reviewing in the app¶
The app's Footprint review tab does the review itself: it draws a footprint over the datasheet's drawing, and Accept records a review of its hash for the MPNs it fits in the part source, as berc fp accept does. The part source is a setting (Settings, Review record: part source), a file in the parts snapshot's shape; without it Accept is off and says so.
- Pick what to review: open a board or project (
.kicad_pcb,.kicad_pro,.kicad_sch) for its footprint hashes and covers, one row each asberc fp todolists them, those to review first; or a symbol library (a.kicad_sym, a.kicad_symdirfolder, or a nickname from thesym-lib-tables) for its symbols, judged asberc fp check --libjudges them against the part source. Each row shows its status (changed, uncovered, partial, ok, unknown MPN, no MPN, missing, no footprint). A board row opens the library footprint its review is of, drawn with the library's own margins: that is what the pairs are of. A footprint whose library file is not found opens as its first reference places it, marked as reviewed as placed. A note above the canvas says which footprint is shown, the board setup's mask and paste margins (which apply to every footprint alike, and which the library footprint is not drawn with), when the board places a different footprint than the symbol's ownFootprintfield names, and each board copy that differs from its library footprint, naming what differs: not part of the review. A library row opens the library footprint itsFootprintfield names, found through the project's or the globalfp-lib-table. A symbol that sets no footprint, or whose symbol or footprint is not found, is refused with the reason. Next to review steps to the next row that needs one. A row lists the part source's reviews that name it (what each was made against, its MPNs, ok or of an earlier hash) and the MPNs no review covers yet. - Open the datasheet: the symbol's
Datasheetfield when it names a local file, a local document library search, or Open PDF. The library search runs a command (a setting) with the datasheet's file name, a part name in its web address, theMpnfields or the value, until one finds something. The command prints a JSON list of{"path": ..., "page": ...}. What it finds is listed in a panel of its own, and for a symbol just picked the first one opens by itself. Picking another symbol opens its datasheet, or closes the last one when it has none. A row whose review recorded its datasheet opens that PDF first, found in the document library by its content hash, else by its document number, and with it the view the review was made in: the page, the scale and the footprint's placement. So does opening any datasheet a review was made on. A review of an earlier hash of the footprint is said so, and a recorded PDF the library doesn't have is said too. The library's catalog comes from mx3's document library (mx3_api_lab's/lib/docs), a file's hash and document number with ashare/paththe file on disk is then found through (this computer's library folders,MX3_LIB_ROOTS). A symbol withMpnfields gets a table, Datasheets by MPN, at the top of the Datasheet section: each MPN, the library document that covers it, how it was found, and its review state (reviewed, reviewed elsewhere when its review was made on another document, stale when only a review of an earlier hash covers it, or not yet). Which document covers an MPN is the document library's answer, not better_erc's: mx3'sby_mpn(/lib/by_mpn) names each document of an MPN, best first, how it was found (a fetch by part number, a file's origin or name, or a person's or the library's own coverage: a part cover, a family, a pattern, the MPN on the first pages), or why it has none. A series or catalogue file may cover several MPNs. Each MPN is asked once per session. Clicking a document opens it with the view of its review, else the page search runs. An MPN without a document says why, and its Fetch button runs a command (library_fetch,mx3 lib fetch --mpnby default) with the MPN, then asks about it again. There are no extraDatasheet2..Nfields: the library holds the mapping. The page search then goes to the page with the land pattern, found by words such as "recommended land pattern" (a setting); the pages it found are listed to pick from. F shows the page at the view's full width. - Set the scale: R with the pointer at one end of a dimension of the drawing, R again at the other (or pick Scale on the mode bar and drag along it). The ruler snaps level: horizontal or vertical by the larger of its dx and dy, an end dragged goes where it is dragged and the other end follows on that axis (Shift held, or the setting off: any angle). Its ends snap to the drawing's own lines, read from the PDF's vector paths: within 10 screen pixels (a setting, 0 for never) to a line's end or two lines crossing, else onto the nearest line's centre; on a level ruler each coordinate on its own, so on a horizontal ruler an end takes the X of the extension line beside it and the Y of a line along it. Thin filled rectangles count as lines, and the edges of other filled shapes (a pad drawn filled) as lines too. Where an end would snap shows at the pointer before it is placed: the lines in orange, a square on an end, a cross on a crossing, a ring on a line. Alt held leaves an end where the pointer is. Z zooms in on the first end, where a click or a drag puts it exactly; Z again on the other end. The number the dimension prints between the ruler's ends, read from the page's text, is outlined and offered as a chip beside the ruler's length (
2.00 mm · D): D or a click on it sets the scale from it. S goes back to the view and asks the length in a box in the middle of the canvas, the number typed shown large in mm: type the length and Enter sets the scale, Esc leaves the box without one (the side panel's field and Set scale do the same by mouse); Z a third time does what S does. The keys of the whole step: F, R, R, Z, Z, S, the length, Enter; with the snap and the dimension's number, often F, R, R, D. A page that states its own scale (SCALE: 20X) offers it as a button; check it with the ruler. Once the scale is set, the mode is Move again. - Lay the footprint on the drawing: drag it (the Move mode, M), nudge it with the arrow keys (Shift: ten times as far), turn it with T or ⟲ 90° or by an angle, mirror it with X for a drawing seen from below. Opacity, Blink (B) and Invert page (I, white-ish on black, for a dark drawing or just to see differently; the default is a setting) help to see both, and so does the blend mode: Normal (the footprint over the page by its opacity), Multiply (the drawing's lines stay dark through it), Screen, or Difference: with white copper (a setting), white paper under a pad goes black, so a footprint that covers the drawing's pads exactly leaves no light edge, and a pad that misses shows light (inverting the page keeps these meanings: Difference still reads the same, now on black). Three views show what the board makes on one layer, one view at a time (a radio choice, C cycles through them), each filled in its one colour: Copper (the pads' copper, the copper graphics and the package's vias, red), Mask (the mask openings only: each pad's by its margin, and the mask graphics, pink) and Paste (the paste apertures only, such as the windows of a split exposed pad, gray). The pads are not drawn outside the Copper view; holes and pad numbers are drawn over every view. The margins are the pad's, else the footprint's, else the open board's design settings (
pad_to_mask_clearance,pad_to_paste_clearanceand its ratio) for a footprint of that board or its project's libraries. Back pads (the back side in the same views), Courtyard, Fab, Silk and Board edge are shown or hidden each by its checkbox. The colours are settings only, with no picker in the tab. A package's vias (round plated pads without a number of their own, such as thermal vias in an exposed pad; KiCad has no vias in footprints) are copper with their holes; they are in the review hash as the pads they are. Scroll zooms at the pointer; the right or middle button pans; Page Up and Page Down turn pages. In Move a double click puts the footprint's origin under the pointer and a double right click the 3D model's (the shaded model, else the picked silhouette view), turn, mirror and the view kept. A help line under the canvas names the keys. - Measure and write notes: a bar above the canvas shows the modes, each with its key, the one on highlighted and named first in the help line: Move (M: the mouse moves the footprint), Scale (R: the ruler that sets the scale), Measure PDF (E: the ruler on the drawing's lines, snapping as the scale's does) and Measure footprint (G: the ruler on the footprint, its ends snapping to the pads' centres and, on rect and roundrect pads, to the middle of each side, where the pad's centre cross meets its edge; a cross in a ring marks a centre, a diamond a side). Esc, M or a mode's own key again go back to Move. A measuring ruler shows its length with dx and dy, and once let go its length goes into the review note as
M1 = 1.234 mm; moving an end changes that value, a new ruler isM2. The scale's ruler waits while measuring and is back in Move. The note field sits above the canvas; Enter over the canvas gives it the keyboard, and Enter in it (or Add) appends the note to the notes file: a Markdown section per note with the symbol, the footprint, the datasheet and its page, the time (UTC) and the text. The file is a setting, by defaultfootprint-review-notes.mdbeside the project or library under review (an absolute path puts it anywhere). The datasheet is named as the document library names it, by a command (a setting;tpm lib open --jsonby default) that prints a JSON list of{"path", "value", "doc_no", "doc_rev"}: by its document number and revision where they are known (`tpm d DS13560 rev6`, which still finds it after a rename or a move), else by the words that open it, else by its file. The next note's measurements count from M1 again. - Select and save as DXF: Select (V), the fifth mode, picks pieces of the datasheet's drawing as the PDF draws them: a line, a polyline, an arc or curve, a closed shape. A click picks the piece under the pointer (inside a filled shape counts), again drops it; a click on nothing drops them all. A drag selects what lies wholly inside its box; Shift adds to the selection. The pieces selected are drawn over the page in cyan, the one a click would pick in a lighter cyan. Save DXF (W, the button under the mode bar, or the pie) writes them as a DXF beside the notes file,
<symbol>-p<page>-<n>.dxf, and appendsDXF `Rev_Mixed-p2-1.dxf`to the note, so the note links to it. The DXF is in the footprint's millimetres: the page's points go through the scale and back through the footprint's placement (origin, rotation, bottom view), so KiCad's footprint editor, File → Import → Graphics at 0, 0, drops the drawing in place over the pads (DXF's Y points up; the import turns it over). It is R12 ASCII (LINE, ARC, CIRCLE, POLYLINE) with a few comment lines naming the symbol, the footprint and the page, so an agent reads it as text too. Curves become arcs and circles where they follow a circle within the DXF curve tolerance (a setting, 0.005 mm), any other curve becomes straight pieces within it. Save stays disabled, saying why, until something is selected, the scale is set on the page shown and a footprint is shown. - The 3D model and Measure model: 3 (a setting, the 3D button in the mode bar, the pie) swaps the canvas between the page and the footprint's 3D model. The STEP files of its
(model ...)entries are found and read asberc fp modeldoes, on a worker thread, and placed as KiCad places them: on a 1.6 mm board whose top is z 0, with the front pads' copper on it. Drag turns the model, the right or middle button pans, the wheel zooms at the pointer, a double-click turns about the point under it, a right-click gives the preset views; the SpaceMouse drives all six axes there. Measure model (O, the sixth mode, which shows the model by itself) measures on the faces and edges as the STEP file writes them, not on the triangles: a click picks a face or an edge, a second click another. Two parallel planes give their distance and two planes at an angle the angle; two cylinders, holes or circles the distance of their axes (a pin pitch); a plane and an axis parallel to it the axis' height; a plane and anything else the point's height over it; the same cylinder or circle twice its diameter, the same edge twice its length; anything else the straight distance. The result is drawn on the view and goes into the review note asM3 = 1.270 mm (pitch, axis to axis), numbered with the rulers' measurements. What is under the pointer shows at the top of the view (pad 2: plane facing +Z at z 0.035 mm,part: hole Ø 0.800 mm). The side panel's 3D model section names each file with its parts, faces, size and height, and what could not be read. A footprint that names no model, or a file not found, says so in the view and the section. - The model's views over the page: the model's top, bottom, front, back, left and right views drawn over the datasheet at the page's scale, to hold against the package drawing. Each is the model's silhouette filled in its colour (a setting,
colors.model), outlined, with the edges seen from that side (colors.model_edges); edges hidden behind a face are left out. The top view lies as the footprint does, the side views stand on the board's line through the origin, the bottom view is mirrored as a package drawing's is. K (a setting, the pie) shows the next view, the top view first on the footprint and the others in the middle of the canvas. There is no pick to make first: the arrow keys, turn (T), mirror (X), blink (B), the SpaceMouse and the Placement section act on what the pointer is over (the footprint, a view, the 3D model), else on what it was last over, which the canvas marks with a dashed outline while the pointer is off it; a view K just showed is that one until the pointer moves. Where two overlap the one the pointer came from wins, so a view on the footprint is reached from its part outside the footprint, or with the footprint hidden (H). Each view keeps its own place, all share the page's scale. A right click on the model (a view, or the shaded 3D model) opens Add projection: the side picked is added under the pointer, to be dragged beside the datasheet's drawings, so one side may be shown more than once; on a view the menu also takes that view off. A double right click brings the model to the pointer instead. The projections are saved with the row's view and drawn over the 3D model too. The side panel's Model views section adds or takes off each side and sets the views' blend mode (normal, multiply, screen, difference), opacity and blink. Measure footprint (G) snaps to the views' outline corners and edge ends too, so a model dimension measures on the page. The footprint is drawn over the views where they overlap. - Accept (A): when the footprint matches the drawing, Accept records a review of its hash in the part source, and for a board row refreshes the project's parts snapshot from it (as
berc fp acceptdoes); the list is read again and the row shows it reviewed. The review records where it was made: the datasheet by the document library's content hash, document number and revision, the page, the scale, the footprint's placement, the review note, who (a setting, else the login name) and the day. It asks first which MPNs this datasheet covers, and for each whether alone or its whole family (where its MPN decodes into one). A board row's MPNs share one cover: all ticked. A library row's MPNs found in the PDF's text are ticked, and those a review made on this datasheet covers, except an MPN that a review on another datasheet covers. The question shows what its dry run would record, following the ticks: the part source, what the review covers, the references, the MPNs left out. Each datasheet keeps its own view of the row (page, zoom, scale, placements, ruler, note), saved with the tab: opening another datasheet and coming back finds the first as it was left, accepted or not. When the board places a different footprint than the symbol's ownFootprintfield for every reference, a checkbox offers to also set that field to the placed one, showing both; checked, it writes the same asberc fp accept --footprintdoes, and lists the files. It then warns, per file and naming the lock file, when KiCad may overwrite that write on its next save: a file with KiCad's lock file beside it (~name.kicad_sch.lck, open in an editor there) that is held. A lock from this computer is held while a KiCad runs here (KiCad's locks name the user and host, no process id; a lock with apidwhile that process lives); one from another computer always counts; an empty one is stale, as KiCad takes it. KiCad running with no lock beside the file is no warning. Enter (or Record) records; Esc (or Cancel) records nothing. Once recorded, it names the review and the snapshot refreshed, or says why it recorded nothing, copies the hash to the clipboard and keeps the review (footprint, hash, datasheet, page, scale) in the tab's list. Accept stays disabled, saying why, until a row with MPNs and a footprint is picked, a part source is set, a datasheet is open and the scale is set on the page shown.
Files changed on disk¶
The tab shows the files as they are on disk. It watches every file it read: the board and its schematics, the library tables, the symbol libraries, the footprint files, the 3D models and the datasheet. A file saved in KiCad or another editor is read again by itself once it stays quiet for a moment, and picking a symbol or a board footprint looks at the files first. Reload (F5, a setting, or the button under the Open buttons) reads everything again; a line beside it says what was read again and when. A reload keeps the view: the page, the scale, the footprint's placement, the 3D camera and the list's filter. The review status follows the file, so a footprint changed since its review shows the review as changed. A file counts as changed only when its content changed; what Accept writes reloads nothing.
With a SpaceMouse¶
A 3Dconnexion SpaceMouse drives the review through spacenavd, the free driver (sudo pacman -S spacenavd, sudo systemctl enable --now spacenavd; other distros: their spacenavd package). The app reads spacenavd's socket itself (ve_spacemouse, pure Rust, no libspnav), so the device is not needed to build or run it.
- The puck moves the page: slide it and the page follows the hand, lift it and the page moves up, push it away and the view zooms out about the pointer (pull it towards you to zoom in). The slide pans in screen points, so a push moves the page across the screen at the same speed at every zoom. P switches the puck to move a thing over the page instead, at the same screen speed: what the pointer is over, else what it was last over; zooming stays the view's.
- Tap a button: the left one lays the ruler (R at the pointer: once for the first end, again for the other), the right one switches what the puck moves (P).
- Hold a button: a pie menu opens at the pointer. Move out across its outer circle, or click, to do the action under the pointer; while the button is held, back through the middle and out again does the next one. The left button's ring has the page and the ruler (full width, zoom on a ruler end, type the length, the dimension's number, back to Move, measure the PDF, select the drawing, next and previous page, invert the page); the right one's the footprint (turn 90°, bottom view, blink, copper/mask/paste, measure the footprint); both buttons together Accept, Next to review, Write a note and Save the selection as DXF. Every slot names its action and its key (
Turn 90° · T); a slot that can't be used now is drawn muted and says why under the menu ("No ruler yet: R lays one, or the left button's tap"). While Accept's question is open, the left tap writes and the right one cancels. - Calibrate… (SpaceMouse, in the tab's side panel) measures which way the puck reads and which button is which: it asks for one motion at a time (slide right, lift up, push away, each button), works the mapping out from what it recorded and shows a table to confirm. The side panel says whether spacenavd is there and, when not, what to do.
- One mapping for every app: the mapping (axes, signs, dead zone, speeds, buttons) is not the app's own but ve_spacemouse's shared
spacemouse.toml, the same settings panel as in every app on it. It is read from.config/spacemouse.tomlin the folder the app started in and each parent, then~/.config/spacemouse.toml, merged key by key with the nearest file winning, as Cargo reads its config. The panel shows which file each value comes from; Save (and a used calibration) writes to every folder's file,~/.config/spacemouse.toml, or to this project's. A[spacemouse]section thatconfig.tomlkept up to 0.4.42 moves into~/.config/spacemouse.tomlat the tab's first start, once: keys that file already has keep their values, then the section leavesconfig.toml(the settings' note says what moved).
A footprint opened alone (Open a footprint alone, a .kicad_mod) or picked from a board's footprint list is a preview: it is drawn over the datasheet the same way, but there is no symbol to put the hash on, so Accept is disabled and says so. A board footprint shows its library file, and the tab says whether the board copy is the same, else what it differs in.
PDFs are read and drawn by hayro, in pure Rust, on a thread of its own. The blend modes other than Normal are a wgpu shader that reads the page's own pixel under the footprint. The PDF standard fonts that a datasheet uses without embedding them come from the Liberation fonts when installed, else from egui's own font.
The settings (blink rate, the opacity, blend mode and colours at first, whether the page is inverted at first, the page search words, the finest drawing scale, the font folders, the library search command, the library name command and the notes file, the library fetch command (library_fetch) and the reviewer (reviewer) for the review record, the allowed library nicknames (allowed_libraries, the app's side of --allow, none by default), how far Z zooms in, whether the ruler snaps level, how near its ends snap to the drawing's lines, the DXF curve tolerance, and the keys F, M, R, E, G, Z, S, D, T, X, B, C, I, P, A, N, Enter, V, W, 3, O and K by name in [footprint_review.keys]; a file that still has M for the bottom view takes X for it) are in ~/.config/better_erc/config.toml ($XDG_CONFIG_HOME, or the file $BERC_CONFIG names), section [footprint_review]; the tab's Settings shows and saves them. The SpaceMouse's mapping is in spacemouse.toml (above). Each step of a review is recorded in berc's usage record (app fp-review accept, app fp-review write, ...), which berc usage counts in its app column.