Open In progress general

altium_build_schematic wires pins of every display mode, shorting nets

idan gida · ·marked in progress by kcknox

altium_build_schematic draws stubs and net labels at the pins of every display mode, shorting nets

Component: altium-bridge 0.2.120, altium_build_schematic (agent CmdBuildSchematic in AdomAgent.pas.tmpl). Secondary items for adom-aiflow (tools/altium-project.py, cmd_schematic) at the end.

What was run

adom-aiflow altium schematic --netlist design/netlist.json --name <Design> on a 144-part design (118 parts with symbols, 81 nets, 11 blocks). The project library was built by adom-aiflow altium library, whose symbols carry several display modes (one symbol had 10 modes, 120 pins = 12 pins x 10).

Symptom

ERROR: ... the compiled sheet's netlist differs from nets on 61 net(s). The compiled netlist had 32 nets, one with 315 pins holding both pins of many decoupling capacitors (GND, +5V, +3V3 and others merged). The render looked tidy; the shorts are not visible because the extra labels sit exactly on the visible stub ends.

Cause

altium_sch_items on the sheet: 918 net labels and 716 wires for 348 netted pins. Exactly 348 labels sit on the shown pins' stub ends with the right net; the other 570 come from the pin loop in CmdBuildSchematic:

PIt := Inst.SchIterator_Create;
PIt.AddFilter_ObjectSet(MkSet(ePin));

This iterates the pins of every display mode (and every part) of the placed component, not only the shown mode. Each hidden-mode pin gets a wire and a net label at its own location. When the modes place pins differently (for example, pin 1 in mode 3 sits where pin 4 is in mode 0), a label of one net lands on another net's stub, and the compiler joins the nets. The measuring loop already filters with IsDrawn (mode 0), so the layout is right; only the wiring loop is wrong. Rebuilding gives the same 918/716 counts, so these objects are not left over from an earlier run.

Fix (applied locally, verified)

In the pin loop, skip pins that are not shown:

PinShown := (Pin.OwnerPartDisplayMode = Inst.DisplayMode) And
            ((Pin.OwnerPartId = 0) Or (Pin.OwnerPartId = Inst.CurrentPartID));

When PinShown is false, draw no wire or label and do not list the pin in pinsWithoutNet. After altium_agent_stop, the next verb re-rendered the agent. The same design then compiled to the netlist pin for pin.

Nice to have: altium_sch_items lists the same item once for each object stacked at a spot. A de-duplicated count, or a warning about stacked objects, would have made this obvious.

adom-aiflow items found on the way

  1. When the netlist names a pin the symbol lacks (for example a datasheet's shared-pad alias "A1/B12", or "TAB"), the mismatch only shows as an extra single-pin Net<Ref>_<pin> and a missing pin. altium schematic could check, before drawing, that every netlist pin exists on its symbol, and name the pin.
  2. Altium reports "Net X has only one pin" for nets whose other pins are board-only parts (MPN-less test points) kept off the sheet. That is expected, but the proof records it as an ERC failure (erc.pass: false). Proposed: put those messages in erc.expectedBoardOnly. The diff is attached; it was not applied, because the tools are compiled into the binary.
  3. Proposed safeguard (same diff): close the design's sheet, board and project before altium_build_schematic, so a copy a previous run left open is never drawn on.

3 Replies

Colby Knox ·

Thanks for the precise diagnosis. The wiring loop has to skip pins of the modes and parts that aren't shown, exactly as you found, and I'm making that fix in CmdBuildSchematic now. I'll also look at the stacked objects in altium_sch_items. The three AI Flow items go to the AI Flow maintainers. I'll post here when the build is out.

Colby Knox marked this in progress ·
Colby Knox ·

The three AI Flow items are in adom-aiflow 0.2.159 (adom-wiki pkg install adom/adom-aiflow). Your diff was not on the issue, so I wrote them from your description:

  1. altium schematic now checks every netlist pin against its symbol, in every display mode, before anything is drawn. An alias like "A1/B12" is named together with the pins the symbol does have; a pin like "TAB" is named with the symbol's own pins listed.
  2. "Net X has only one pin" for a net whose other pins are on board-only parts goes to erc.expectedBoardOnly, and only the rest decide erc.pass.
  3. The design's sheet, board and project are closed before altium_build_schematic, so a copy left open by an earlier run is never drawn on.

The display-mode wiring fix itself comes in the altium-bridge build announced above.

Colby Knox ·

Fixed in altium-bridge 0.2.123 (insiders now).

  • altium_build_schematic wires only the pins the placed part shows: those of its current part and display mode, plus the pins shared by every part. The same rule now holds in altium_sch_connect and in altium_sch_place_part's pin count, which counted every mode's pins.
  • altium_sch_items gains stacked: objects lying exactly on top of each other, the sign of a doubled placement.

Checked with a 9-pin symbol carrying two display modes: 9 net labels for 9 pins, nothing stacked, and the compiled netlist matched the design.

If it holds up on your side, say so here and I will close this.

Log in to reply.