DRAW checks¶
The DRAW checks of the check catalogue. Each check has a page of its own: what it catches, why it matters, an example, how better_erc finds it, the usual fix and where to read more, with the test schematics that show it firing.
These checks read the drawing, not the netlist: positions, angles, fields, text, the title block. The drawing facts (NET-21) carry labels and flags today; the geometry they need (wires with their ends, field positions and angles, text, text boxes, tables and groups, paper size, title block, symbol body extents) is NET-26, planned.
Boxes. Several checks compare item boxes: a symbol's body with its pins (from the library graphics, placed by its rotation and mirror), a field's or label's text box (from font size, text length, justification and the angle relative to its symbol), a power symbol with its name, a note box, a wire as a thin box. A symbol body is not one box but the set of what its library draws, each on the centreline of its stroke, the width left out: a rectangle, a circle, a closed or filled polyline as a filled shape, an open polyline segment or a piece of an arc as a line, a bezier by its control points' box. Two bodies, or a body and a box, are as far apart as their nearest primitives; the outer boxes are compared first, so a pair far apart costs one test. A text box drawn wholly around an item counts against it by its text alone: the border is a frame around the parts a note is about, not something in their way. An item the border crosses (partly inside) still overlaps the box. Against a wire a text box always counts by its text: its border may cross or run beside wires, its text may not. A prototype of this measure (Python, run on a real board's sheets) is kept with the house-style notes; it is the reference for NET-26.
Text extents. A text is measured in the font KiCad draws it in: its own face ((font (face "..."))), else the default font, else KiCad's stroke font. The default font is drawing.font, set in the project file or with --set; unset, it is KiCad's own (appearance.default_font in eeschema.json of the newest KiCad configuration, under $KICAD_CONFIG_HOME when that is set). Inside KiCad the schematic editor passes its live setting. An outline (TrueType, OpenType) family is found among the system's fonts, in the text's weight and slant, and measured as KiCad's outline font does: HarfBuzz's advances with kerning, at 1.4 times the text size; widths match kicad-cli's to 0.001 mm. The box height stays the text size, as for the stroke font: an outline font's cap height at KiCad's scale is within a few percent of it. A family the system does not have is measured in the stroke font, and the run's notes say so once. _{sub} and ^{super} text is measured at its smaller size. A free text (not a field or a label) sits higher than its anchor and justification alone say, and its box follows it. KiCad lifts every free text by 0.25 mm, and a text in an outline font by a further 0.4 times the amount its line box (the face's ascender plus descender) exceeds the text size. A 1.5 mm cost line in IBM Plex Sans sits 0.84 mm above where a field with the same anchor would, nearly half its height.
Style checks. Some checks judge only how the drawing looks: DRAW-1, 2, 5, 7 to 14, 16 to 18, 21, 24, 27 to 38 and 40 to 49 (erc_checks::STYLE). An editor shows their findings as a group of their own, so the reader can fix the circuit first and tidy the drawing later; the C++ bridge marks them with Violation::style. The other DRAW checks stay with the schematic findings, because what they catch can hide a real mistake, such as a T without a junction (DRAW-4) or a DNP part the BOM does not know about (DRAW-23).
Drawing settings. The spacing checks share named settings with defaults, set per project in its better_erc project file (CFG-2); see clearance margins:
| Setting | Default | Meaning |
|---|---|---|
drawing.clearance.part |
1.27 mm | margin around a symbol's body and its pins |
drawing.clearance.power |
1.27 mm | margin around a power or ground symbol and its name |
drawing.clearance.text |
0.635 mm | margin around a field, a label, a pin name or number, a note box |
drawing.clearance.spacing |
tight | tight: two parts' bodies, pins and fields need only the packed margin between them; sparse: their own margins |
drawing.clearance.packed |
0.127 mm | margin around a part's body, pins and fields against another part's, in tight spacing |
drawing.section_gap |
10 mm | gap that separates two sections (DRAW-31, DRAW-16) |
drawing.bus_hint.places |
3 | places each net of a group must reach before DRAW-39 suggests a bus |
drawing.bus_hint.members |
4 | nets a group needs before DRAW-39 suggests a bus |
drawing.route.w_len, .w_bend, .w_cross, .w_cross_near, .w_symbol, .w_detour |
1, 2, 4, 8, 6, 4 | the routing cost weights (routing is a weighed compromise), DRAW-40 |
drawing.route.detour_max |
1.5 | drawn length over Manhattan length of a tie above which DRAW-40 looks for a cheaper drawing |
drawing.pin_lead |
1.27 mm | straight wire at a pin or power symbol before the first bend (DRAW-41), and the least wire between two pins (DRAW-29) |
drawing.align.window |
20.32 mm | neighbourhood within which items must align exactly (DRAW-36, DRAW-40) |
drawing.align.snap |
5.08 mm | offsets below this (and above zero) are near misses (DRAW-36, DRAW-40) |
drawing.align.reach |
0.5 | farthest apart two items may be and still be compared, as a share of the page's longer side (DRAW-36, DRAW-40) |
drawing.font |
KiCad's default font | font family a text that names none is measured in; KiCad Font is the stroke font (text extents) |
drawing.label.stub_extra |
1.27 mm | stub a local label needs beyond its text length (DRAW-28) |
drawing.heading_size |
2.54 mm | text size of a section heading (DRAW-31, DRAW-32) |
drawing.group_heading_size |
1.905 mm | text size of a group heading (a table's title, a group of directives); free text this size or larger is a heading (DRAW-32) |
drawing.leader.clear |
0.635 mm | gap from a leader's tip to the part's outline, along the leader's line (DRAW-46) |
drawing.leader.aim |
2.54 mm | how far from the body centre a leader's line may pass (DRAW-46) |
drawing.fields.pitch |
2 mm | baseline-to-baseline distance between the lines of a field column, the same on every part (berc place-fields) |
drawing.fields.body_gap |
0.635 mm | space between a field column (or a packed part's Reference and Value) and the body and pins (berc place-fields) |
drawing.fields.step |
0.25 mm | grid field anchors are placed on, and the step a column slides or moves out by (berc place-fields) |
drawing.fields.gap_max |
2 mm | fields farther than this from their body are placed again (berc place-fields) |
drawing.fields.ends_raise |
1.27 mm | how far above a horizontal packed part's pin line its Reference and Value sit (berc place-fields) |
drawing.fields.rating_rounding_max |
1 % | most a rounded Voltage or Power text may differ from the lowest rating of a part's MPNs (BOM-12, berc fields sync) |
drawing.leader.angle_slack |
3° | how far the last segment may be off 45° (DRAW-46) |
drawing.leader.reach |
5.08 mm | how far from a part a leader's tip still counts as ending at it (DRAW-46) |
DRAW-46.max_pins |
4 | most pins of a small part (DRAW-46) |
drawing.note.item_words |
15 | most words in a sentence of a note item (DRAW-47) |
drawing.note.item_marks |
3 | most ;, : and ( in one sentence of a note (DRAW-47) |
drawing.note.colour_slack |
8 | counts per RGB channel a note box colour may be off its kind's colour (DRAW-32) |
drawing.note.colour.todo, .information, .caution, .debug, .critical, .layout, .cost, .ref |
unset | a note kind's box stroke colour, rgb(r, g, b); unset: a legend box's, else the drawing guide's (DRAW-32) |
drawing.block.reach |
25.4 mm | how far from a block's nearest part or heading a note may stand and still belong to it (DRAW-48) |
drawing.block.tie |
2.54 mm | blocks this much farther from a note than the nearest one get the note too (DRAW-48) |
drawing.notes |
unset | the board's notes files, paths relative to the project directory, separated by commas (DRAW-50) |
drawing.route.k_power, .k_ground, .k_signal |
2, 2, 1 | factor on the bends and detours of power, ground and signal ties (DRAW-40) |
drawing.route.min_saving |
2 | cost a redraw must save to be reported (DRAW-40) |
drawing.route.step |
2.54 mm | the grid step wire is counted in (DRAW-40) |
drawing.section.reach |
5.08 mm | how far left of its heading a section's parts may stand |
drawing.section.snap |
10.16 mm | offsets of section tops or left edges below this are near misses (DRAW-45) |
drawing.colour.pair_min |
20 | least CIEDE2000 difference between touching items (DRAW-42) |