Closed bug report

schematic check: a diode drawn as an open triangle plus a separate base line reads as backwards (the tie-break takes the base for the cathode bar)

Drew Owens · ·closed by John Lauer

adom-aiflow 0.2.21 · KiCad 10.0.7 (macOS) for ERC · project: a 4-layer board with 16 photodiodes (drew715/smart-laser-target)

What I did. netlist check (which runs the schematic check) on a schematic whose custom photodiode symbol (BPW34S, pin 1 K, pin 2 A) draws the cathode bar at the pin 1 end, the triangle as an open 3-point polyline pointing at it, and the triangle's base as a separate 2-point line:

(polyline (pts (xy -2.54 1.27) (xy -2.54 -1.27)) (stroke (width 0.1524)))   ; cathode bar, pin 1 (K) end
(polyline (pts (xy 0 1.27) (xy -2.54 0) (xy 0 -1.27)))                       ; triangle, open, apex at the bar
(polyline (pts (xy 0 -1.27) (xy 0 1.27)))                                    ; the triangle's base, pin 2 (A) end

Expected: no polarity error; the bar is at the cathode.

What happened (an error, so finish refuses):

polarity drawing: D1,...,D16 (smart_laser_target:BPW34S-Z, custom symbol): the cathode bar is drawn at the pin 2 end, but pin 1 (K) is the cathode, pin 2 (A) the anode

Why (schematic_symbols.rs, diode_check): a triangle is recognised only as a closed 3-point polyline, so tri is None here. Both vertical lines then qualify as bars with the same across extent (2.54 mm), and max_by returns the last of equal maxima, which is the triangle's base at the anode end (t = 0.33, under 0.4), so it reports an error.

Suggestions:

  1. Recognise an open 3-point triangle whose base is a separate line (or join open polylines that share end points before matching).
  2. When no triangle is found and two bars tie, prefer the thicker stroke, or report "cannot tell which end" as a warning rather than an error.

Worked around by closing the triangle in the symbol, which draws the same picture: (pts (xy 0 1.27) (xy -2.54 0) (xy 0 -1.27) (xy 0 1.27)). The check then reads the drawing correctly (0 errors on a preview run).

The same check reads a magnetic buzzer's +/- pins (MLT-8530, "Electromagnetic Passive (Externally Driven)") as amplifier inputs. spec.schematic.allowPassive with that reason covers it, which seems right, so nothing is asked there.

1 Reply

John Lauer ·

Fixed in adom-aiflow 0.2.24. Your diagnosis was exact, down to the 0.33.

  • Joined lines: open polylines that share end points are joined before shapes are matched, so your open triangle plus base line is recognised as a triangle, apex included. The BPW34S passes with no polarity error.
  • Ties: with no triangle and two equal bars, the thicker stroke wins. If the strokes are equal too, it's a warning ("cannot tell which end is the cathode"), never an error.
  • Tests: your exact symbol passes; the same drawing with K and A swapped still errors.

Upgrade: tell your AI "give me the latest adom-aiflow" (or adom-wiki pkg install adom/adom-aiflow); adom-aiflow --version says 0.2.24.

John Lauer closed this ·

Log in to reply.