Open In progress feature request

Anchored dimensions on library footprints (verb), silkscreen clearance check, and stray mechanical layers

MartyPM · ·marked in progress by kcknox

altium-bridge 0.2.118 · Altium Designer Develop 26.x · Windows 11 (Hydrogen local workspace)

Request

A verb that puts anchored linear dimensions on a library footprint: true Altium dimensions whose two ends lock to the footprint's pads or assembly-outline corners, so they follow those primitives when they move. Plus a few related footprint-quality checks.

Why

  • The layer map already has a dimensions key, but no footprint verb draws anything there.
  • DelphiScript can't set a dimension's references. IPCB_Dimension reference setters don't stick, and dimensions made by script come out unanchored. So there's no way to do this through altium_eval either.
  • Organisations that document footprints (pitch, row spacing, body envelope, hole positions) on a dimensions layer currently have to place every dimension by hand.

A method that works (proven on a real part, 2026-12-02)

  1. Write an ASCII PcbDoc containing:

    • the footprint's pads;
    • its assembly (body) outline as four single tracks, one per edge;
    • RECORD=Embedded linear dimensions whose REFERENCE0* / REFERENCE1* fields point at those records: PRIM index, OBJECTID / OBJECTSTRING (Pad or Track), POINTX/Y, and ANCHOR (1 = pad centre; for a track, 1 = X1/Y1 end and 2 = X2/Y2 end).
  2. Open it in Altium. The references validate.

  3. Move the same object instances into the library footprint:

    • B.RemovePCBObject on the work board;
    • Lib.Board.AddPCBObject plus PCBM_BoardRegisteration in the library.

    Don't change their layers, and don't recreate them.

  4. Save, close and reopen the PcbLib, then require References_Validate = True for every dimension.

Observations:

  • Pad references are saved bound to the pad.
  • A reference on a corner shared by two outline tracks is saved as position-only (NoObject), and Altium re-binds it on load. Altium's own hand-placed corner references save the same way.
  • The library's board origin is offset from the ASCII work board's origin (50000 mil in our template). The transfer has to check that offset.

Proposed verbs

  • altium_add_dimensions {libraryPath, footprint, dimensions: [{a, b, dir: "H"|"V", at, expect?}], format?}
    • a / b are a pad name, or an outline corner such as FRONT@1 or LEFT@2.
    • at is the position of the dimension line.
    • Format comes from the call or a library default: text font and height, line width, arrow size, extension offset, units rule (e.g. mil when a length is a whole multiple of 5 mil, otherwise mm to 2 decimals).
    • The dimensions land on the layer-map dimensions layer.
    • The reply lists each dimension's text and its validity after a reopen. With expect (a value in mm, e.g. read from the datasheet), it also reports each one MATCH or MISMATCH against a tolerance.
  • A body-outline option on altium_footprint_from_land_pattern: draw the assembly outline as one track per edge, so it can be dimensioned to its corners.
  • altium_check_silkscreen {libraryPath, footprint, minMm, maskExpansionMm?}
    • Measures, on the saved footprint, edge-to-edge clearance between every Top/Bottom Overlay line, arc and text and each pad's exposed copper (the pad grown by the mask expansion).
    • Reports the closest pair and PASS/FAIL.
    • Today the bridge only trims silkscreen within 0.2 mm while drawing, and nothing re-checks the saved result.
  • The footprint verbs create Mechanical 1 and Mechanical 9 "Adom.SolderBalls" in the library even when nothing is drawn on them. This happened even with an organisation layer map in place; we now map comment and balls to template layers as a workaround. Please only create a layer when a primitive is actually placed on it.
  • altium_edit_footprint graphics: shapes take {type: "line", start: [x, y], end: [x, y]} / {type: "circle", center, radius}, and the width only works at layer level (widthMm). Per-shape widths are ignored, so a filled dot needs two concentric circles. F.Fab resolves to legacy Mechanical 13, so typed layers have to be addressed as L<id>. None of this is in the skill.

3 Replies

Colby Knox marked this in progress ·
Colby Knox ·

Thanks for the detailed write-up, and for proving the ASCII PcbDoc route on a real part. That's the missing piece for anchored dimensions.

Taking the smaller items first, since they're fixes:

  • footprint verbs creating Mechanical 1 and Mechanical 9 "Adom.SolderBalls" when nothing is drawn on them;
  • per-shape line widths being ignored in altium_edit_footprint;
  • F.Fab resolving to legacy Mechanical 13 instead of the typed layer;
  • documenting the graphics shape format in the skill.

The new verbs (altium_add_dimensions, the body-outline option and altium_check_silkscreen) I'll confirm on our side and report back here.

Colby Knox ·

The smaller items are fixed in altium-bridge 0.2.119:

  • Mechanical 1 and Mechanical 9 "Adom.SolderBalls" (and the built-in Fab and Courtyard layers, Mechanical 13 and 15) are turned on only when a footprint actually draws on them. A library with Mechanical 1 turned off keeps it off after altium_footprint_from_land_pattern, and no Adom.SolderBalls layer appears. You can drop the comment and balls workaround mappings.
  • altium_edit_footprint graphics:
    • a shape's own widthMm is honoured (it beats the entry's);
    • {type: "circle", center, radius, filled: true} draws a solid dot;
    • F.Fab and F.CrtYd follow the library's layer map (its fab and courtyard keys; B. takes the bottom layer of the pair), so they land on Top Assembly and Top Courtyard in your libraries;
    • a layer kind name such as AssemblyTop or DimensionsTop also works as layer.
  • The shape format and layer names are now in the altium-libraries skill.

Tested on Altium Designer 26.11.1 and Develop: an F.Fab line with its own 0.25 mm width and a filled dot landed on Top Assembly, at those widths.

I'll follow up here on the new verbs (anchored dimensions, the body-outline option and the silkscreen check).

Colby Knox ·

The three pieces are in altium-bridge 0.2.121 (insiders now; public with the next promotion). Your ASCII route was the key, thank you.

altium_add_dimensions {libraryPath, footprint, dimensions: [{a, b, dir: "H"|"V", at, expect?, toleranceMm?}], format?, layerMap?}

  • a / b: a pad number (its centre), an outline corner TL, TR, BR, BL, or {x, y} (mm) where an outline line ends. at is the dimension line's y (H) or x (V).
  • The dimensions land on the layer map's dimensions layer, and corners are looked up on its fab layer.
  • format takes text height, line widths, arrows, the extension offset, and units: auto (whole mils for a multiple of 5 mil, otherwise mm to 2 decimals), mm or mil.
  • The reply gives each dimension's text and validAfterReopen: the library is saved, closed and reopened, and the references are read back. With expect it also gives MATCH or MISMATCH with the delta.
  • It follows your method: the footprint is copied to a work board saved as ASCII, the dimensions are written in with their references, Altium validates them, and the footprint is rebuilt from the work board's own instances. Pads, lines and dimensions travel together.
    • Moving the dimensions alone saved their references as bare points that didn't follow a pad.
    • The library's 50000 mil origin offset is handled.
    • A layer above Mechanical 16 is written as LAYER_V7 / DIMENSIONLAYER_V7, as Altium does.
    • A later call rebinds the earlier dimensions too.
  • Measured on Altium Designer 26.11.1 and Develop, SOIC-8 with your kind of layer map (fab on Top Assembly, dimensions on Top Dimensions):
    • pad 1 to 8: 5.40 mm; pad 1 to 2: 50 mil; corner to corner: 3.90 and 4.90 mm. All valid after the reopen, all MATCH.
    • Moving pad 8 by 0.5 mm made the row span read 5.90 mm.
    • The rebuilt footprint was identical, primitive by primitive, to a twin built without dimensions, including description, height and 3D body.

altium_footprint_from_land_pattern {..., fabOutline: "edges"} draws the assembly outline as four lines meeting at the body corners, with the pin-1 chamfer as its own line. The reply's summary.fabOutline gives the corner positions.

altium_check_silkscreen {libraryPath, footprint | footprints, minMm, maskExpansionMm?} measures edge-to-edge clearance between every overlay line, arc, text and fill and each pad's exposed copper (the pad grown by maskExpansionMm, else its own manual expansion, else Altium's default 4 mil). It reports the closest pair, every pair under minMm and PASS/FAIL.

  • Round, oval, rectangular and rounded-rectangle pads are measured exactly. An octagon is treated as its rectangle and a text as its bounding box.
  • It confirmed your suspicion: the builder trims silkscreen 0.2 mm from the bare pad, so with a 4 mil mask opening a built SOIC-8 measures 0.143 mm and fails a 0.15 mm rule. Until the builder accounts for the mask, pass a wider silkClearance.

The shape format and these verbs are documented in the altium-libraries skill.

Log in to reply.