KiCad - the KiCad Bridge
Public Made by Adomby adom
Drive your own KiCad from an AI, in the background: open every editor, read the whole board as data (the EDA Bridge Standard board model), stack-up, part heights, netlists, place, route, pour, DRC and exports.
Symbol Editor capture returns a blank canvas ~13% of the time: the capture fires before the render
Symbol Editor capture comes back as a blank canvas ~13% of the time (capture fires before the render)
The Symbol Editor opens correctly, loads the right part, and reports success - but the captured image is a 100% uniform white canvas with the symbol never drawn. The verb reports it as a successful capture, so a caller that trusts the response ships an empty screenshot as proof.
Measured on kicad-bridge 0.9.236, KiCad 10.0, plugin 0.9.1 (pcbnew, IPC 127.0.0.1:8871), over a 30-part run of the web-control library card against Adom basic parts:
4 of 30 symbol captures were blank. Same code path, same part family, no error reported on any of them.
0603SAF1501T5E canvas (255,255,255) 100.00% uniform, 1 distinct colour
0603SAF1502T5E canvas (255,255,255) 100.00% uniform, 1 distinct colour
0603SAF1503T5E canvas (255,255,255) 100.00% uniform, 1 distinct colour
0603WAF100JT5E canvas (255,255,255) 100.00% uniform, 1 distinct colour
A healthy capture from the same run, for contrast - background (245,244,239) with 2,500-4,300 distinct colours in the canvas region:
0402B104J160CT canvas (245,244,239) 90.65% dominant, 3,161 distinct colours
0603X106K100CT canvas (245,244,239) ~90% dominant, ~3,200 distinct colours
The data is fine - this is the capture
Each of the four blank ones renders correctly through KiCad's own CLI:
kicad-cli sym export svg -> 0603SAF1501T5E 195 drawn elements
0603SAF1502T5E 200 drawn elements
0603SAF1503T5E 203 drawn elements
0603WAF100JT5E 185 drawn elements
So the symbol has geometry, KiCad can draw it, and the editor had the right part loaded - the window title on the blank captures reads Adom:<MPN> - Symbol Editor, the library tree shows the part selected, and the Properties pane is populated (Reference, Value, Description all correct). Only the canvas is empty.
Why it looks like a race
- It is intermittent:
0402B103J500CTwas blank in one run and rendered fine in the next, with no change to the file or the call. - It clusters in the fast parts. The card waits ~3.5s after the editor reports ready, then takes ONE capture. On a part where KiCad did not need a library-cache restart the whole part completes in ~50s, and those are where blanks appear; slower parts, which spend longer before the capture, mostly come back drawn.
That pattern says the editor is answering "ready" before its canvas has painted, and a fixed client-side delay is racing it.
The ask
Own the settle inside the show verb. The capture should not return until the canvas has actually painted - the bridge is in the right place to know that, and the caller is not. A fixed sleep on my side is a guess that is wrong ~13% of the time and cannot be tuned without slowing every part down.
Failing that, either of these would help:
- Report canvas emptiness. If the bridge can cheaply tell that nothing was drawn, say so in the response rather than returning a successful-looking blank. A caller can then retry.
- A
waitForRender/settleMsarg so the caller can ask for a verified paint rather than a blind delay.
On my side
I am adding a uniformity check to the web-control card so a blank canvas fails honestly instead of counting as proof - that is my bug too, since the card scored "the editor opened with the right part" as "the symbol rendered". But the check can only reject the capture after the fact; it cannot make the capture correct, which is why I am asking for the settle to move into the verb.
Scope
Symbol Editor only. All 30 footprint captures and all 30 3D captures in the same run came back drawn, and all 90 frames are hash-distinct, so nothing is serving a stale window - the blanks are genuinely fresh captures of an unpainted canvas.
Related: adom/kicad-bridge#51 (the library-cache restart). The two interact - the parts that avoid the restart are the fast ones, and the fast ones are where this shows up.