Adom 2D Board

Install?

Interactive 2D board view: your EDA's own PCB render plus live net/trace highlighting and per-pad stock, price and wiki lookup

adom-wiki pkg install adom/adom-2dboard

Latest: v0.5.1, published

Dependencies 1 app

Contents

README

markdown

adom-2dboard

Interactive PCB layout viewer. The picture is your EDA's own export — the real silkscreen, the real trace widths, the real theme colours — and on top of it sits an invisible, coordinate-aligned interaction layer that knows the netlist. So you get a board that looks exactly like it does in KiCad, except you can click a pad and watch its entire net light up.

A net highlighted in adom-2dboard

Why it works this way

A flat SVG export is authentic but dead — no nets, no pads, nothing to click. A self-drawn render is interactive but never quite looks like your EDA. This app does both at once:

  • Visual base — per-layer SVG straight from the EDA (KiCad via the shared service-kicad container, POST /kicad/pcb/export/svg?layers=<L>), one group per layer, in KiCad's own theme colours.
  • Interaction overlay — the .kicad_pcb parsed in Rust into pads, traces, vias and zones carrying data-net / data-ref, drawn invisibly in the same board-mm coordinate system. No Y-flip, no offset, so the two align exactly.

What you get

  • Net highlighting — click any pad, via, trace or zone fill; the whole net lights in its own copper colour while the rest of the board dims. The net list on the right stays in sync (and is clickable itself).

  • Per-pad hover — pad number, size, shape, side and net, plus live stock, price, wiki page and popularity for the parent part.

    Hovering a pad

  • Layer control — every layer toggles independently, and the Top/Bottom switch mirrors the board and brings that side's stack to the front so you can select parts on the far side.

  • Embeddable — embed emits one self-contained interactive HTML file with no external assets, so any app can drop it in an iframe as a live PCB view. (adom-project-manager uses exactly this for its board pane.)

Molecule plans and built boards

Before there is a .kicad_pcb, the same tool draws a molecule from its plan or its built tscircuit board, in one look: dark green board, red contacts and orange corner pins labelled by net, power contacts ringed yellow, the nominal board dotted inside its wings, each footprint's pads with pin numbers and a pin-1 dot, courtyards (overlaps red, named exceptions amber), and a caption with the measured clearances.

# plan stage: the molecule plan (adom-tsci-molecule `bun scripts/plan.ts`) + footprints + placements; repeat
# --layout to compare variants side by side
adom-2dboard render --layout a-upright.json --layout b-turned.json --out compare.png

# built board: tscircuit circuit.json (+ the board's design.json: corner pin roles, power nets, courtyard
# exceptions); adds traces, vias, copper pours with their gap and edge pullback, and top silk
adom-2dboard render --circuit dist/lib/index/circuit.json --design design.json --out board.png

# the numbers behind the picture
adom-2dboard render --circuit dist/lib/index/circuit.json --out board.svg --json

Two placements of the CD74HC4067 molecule, from plan files

The built 74HC595BQ molecule (8 x 8 with 2 mm top and bottom wings): bottom VCC / GND pours 0.30 mm apart, 0.40 mm from the edge

  • --out decides the format: .svg, or .png at --width pixels (default 1000), a 256-colour PNG sized for chat (64 to 125 KB for a 10 mm molecule up to a 70 mm board).
  • On a molecule (10 to 18 mm) at 1000 px, 0.4 mm silk reads at about 30 px. On a large board, raise --width.
  • A layout file: { "title", "plan": "plan.json", "machinePinNets": {"MP1": "GND"}, "contactNets": {...}, "powerNets": [...], "parts": [{ "ref", "footprint": "u1.kicad_mod", "x", "y", "rotation", "pins": {"1": "COM"}, "label" }], "courtyardExceptions": [{ "refs": ["U1", "C1"], "reason" }] }. Paths are relative to it. examples/ holds three: the 74HC595BQ (8 x 8 with 2 mm top and bottom wings) and the CD74HC4067 A / B.
  • --json lists every machine pin, contact and pad position, clearances, crossings, free slots, courtyard overlaps, pours (gap, edge pullback) and silk text.

Install

adom-wiki pkg install adom/adom-2dboard

Use

# one self-contained interactive HTML (what you embed in another app)
adom-2dboard embed --file board.kicad_pcb --out board.html

# a composed interactive SVG (+ board.meta.json with --meta)
adom-2dboard render --file board.kicad_pcb --out board.svg --meta

# the live app — hover/click, with enrichment served from /enrich
adom-2dboard serve --file board.kicad_pcb --port 8790

Embedding in your own app

embed inlines the SVG, the metadata and the viewer JS into a single file, so an iframe is all you need:

<iframe src="/board-view/my-board/pcb" style="border:0;width:100%;height:100%"></iframe>

An embed has no server of its own, so its enrichment fetch("enrich") is relative — it resolves against whatever serves the page. Host apps can answer it (/…/enrich?mpn=&lcsc=) to give the embedded card live stock and price; if nothing answers, the card simply shows identity only.

Enrichment

Hover data comes from sibling Adom CLIs, cached per part and fetched off the render path (/enrich returns {"pending":true} and warms in the background, so hovering never blocks):

  • adom-parts-search search <mpn> — stock and price
  • adom-wiki discover search --query <mpn> --json — wiki page and popularity

Notes

  • Requires network access to service-kicad; override with KICAD_SERVICE_API. If it is unreachable the app falls back to its own self-render so you still get a usable (if less authentic-looking) board.
  • KiCad today; the same overlay architecture is what will carry Altium and Fusion exports.

See also: adom-schematic — the same idea for .kicad_sch.