Option to skip automatic schematic trace routing while keeping the schematic (schematicTraceRoutingDisabled)

Aperta
#5,151 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@cocvn157 ci sta già lavorando.

Dal 5/11/2026.

  • #5165 di @cocvn157 — aperta
  • #5258 di @jeffrey-graham — chiusa senza merge

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
react, typescript
Ambito
backend, devtools

Direzione di ricerca

Read the schematic routing entry points: Group_doInitialSchematicTraceRender, Trace_doInitialSchematicTraceRender, and NetLabel.doInitialSchematicTraceRender, along with the existing schematicDisabled precedence and tests. Add schematicTraceRoutingDisabled through the board, platform, project config, and IsolatedCircuit paths described in the proposal, then run the routing tests. Done means routing is skipped at all three entry points when enabled while existing schematic content and PCB output remain as described; the is_connected behavior is still an open question.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

Designs that bring their own schematic wiring still pay for core's automatic schematic trace routing on every render, and today there is no way to turn it off without losing the schematic:

  • schematicDisabled removes every schematic element (components, ports, symbols, sheets, user primitives).
  • The internal _featureMspSchematicTraceRouting = false does not skip routing: it swaps the group-level SchematicTracePipelineSolver for the per-trace router (Trace_doInitialSchematicTraceRender), which throws on traces with more than two ports (GeneralizedAstarAutorouter doesn't currently support 2+ points in a connection, a fatal circuit_generation_failed).
  • tsci build has --routing-disabled for the PCB but no schematic counterpart.

Our case: we convert existing CAD designs to tscircuit. Each chip carries its original symbol as <symbol> artwork with <port>s at the original pin positions, each sheet carries the original wires as <schematicpath>s, and connectivity is <trace path={[...]}>. The router then computes a second wiring on top of the drawn one, and on large boards it dominates the build.

Measurements

tsci build (tscircuit 0.0.3055, core 0.0.2252), routing as today vs the three routing entry points skipped (Group, Trace and NetLabel doInitialSchematicTraceRender, via a Bun --preload for the measurement):

design schematic pins routing on routing skipped
2-layer board, 220 parts 892 62.3 s 38.7 s
6-layer board, 345 parts, 1 746 vias, 149 pours 1 384 1 417 s 409 s
a generated schematic layout of the same 6-layer board (892 traces) 1 384 204–673 s 10.7 s

In a CPU profile of the 1 417 s build, Group_doInitialSchematicTraceRender is 96.5 % of the run (1 449 of 1 501 s).

Synthetic boards from the reproduction below (tsci build --disable-pcb --disable-parts-engine, wall clock including ~6 s CLI start-up):

chips pins source_trace routing on routing skipped schematic_trace on → skipped
16 128 127 10.8 s 7.0 s 104 → 0
32 256 263 13.0 s 8.9 s 210 → 0
64 512 543 21.7 s 9.5 s 420 → 0
128 1 024 1 107 118.0 s 11.0 s 836 → 0

Doubling from 64 to 128 chips multiplies the routing time by about 8 (16 s → 107 s above start-up). (Wall times vary with machine load: a later re-run of the 64-chip case gave 48.3 s vs 9.4 s, with the same 543 source_traces, 512 ports and 420 → 0 schematic_traces.)

Exact behaviour differences when routing is skipped

Compared element by element (multisets of canonical JSON) on the real boards above, in the default and the strict (all-DRC) build:

  • Identical: every source_* element, all PCB elements, cad_component, schematic_component, schematic_port positions and sides, symbols, user schematic primitives (schematic_path, schematic_text, schematic_box…), schematic sheets, PCB DRC errors, and the generated Gerber/drill files.
  • Absent: schematic_trace, schematic_net_label, the schematic_text trace labels (they carry a source_trace_id), and warnings that refer to those elements.
  • Changed: schematic_port.is_connected stays false where a routed wire used to reach the port (today only the routers set it).

Reproduction

// 64 chips with fixed schematic positions; every pin on a net
const N = 64
const COLS = Math.ceil(Math.sqrt(N))
export default () => (
  <board width="200mm" height="200mm">
    {Array.from({ length: N }, (_, i) => (
      <chip
        key={`U${i + 1}`}
        name={`U${i + 1}`}
        footprint="soic8"
        schX={(i % COLS) * 12}
        schY={-Math.floor(i / COLS) * 10}
        pinLabels={{ pin1: "IN", pin2: "B0", pin3: "B1", pin4: "GND", pin5: "OUT", pin6: "L0", pin7: "L1", pin8: "VCC" }}
        schPinArrangement={{
          leftSide: { direction: "top-to-bottom", pins: [1, 2, 3, 4] },
          rightSide: { direction: "top-to-bottom", pins: [5, 6, 7, 8] },
        }}
      />
    ))}
    {Array.from({ length: N }, (_, i) => {
      const u = `U${i + 1}`
      const next = `U${i + 2}`
      const right = i + 1 < N && (i + 1) % COLS !== 0
      return [
        <trace key={`${u}g`} from={`.${u} > .pin4`} to="net.GND" />,
        <trace key={`${u}v`} from={`.${u} > .pin8`} to="net.VCC" />,
        <trace key={`${u}a`} from={`.${u} > .pin2`} to={`net.BUS${i % 4}_A`} />,
        <trace key={`${u}b`} from={`.${u} > .pin3`} to={`net.BUS${i % 4}_B`} />,
        ...(i + 1 < N ? [<trace key={`${u}n`} from={`.${u} > .pin5`} to={`.${next} > .pin1`} />] : []),
        ...(right
          ? [
              <trace key={`${u}r0`} from={`.${u} > .pin6`} to={`net.L${i}_0`} />,
              <trace key={`${u}r0n`} from={`.${next} > .pin6`} to={`net.L${i}_0`} />,
              <trace key={`${u}r1`} from={`.${u} > .pin7`} to={`net.L${i}_1`} />,
              <trace key={`${u}r1n`} from={`.${next} > .pin7`} to={`net.L${i}_1`} />,
            ]
          : []),
      ]
    })}
  </board>
)

tsci build --disable-pcb --disable-parts-engine, once as is and once with Group.prototype.doInitialSchematicTraceRender and Trace.prototype.doInitialSchematicTraceRender replaced by no-ops in a Bun --preload.

Proposal

schematicTraceRoutingDisabled?: boolean (default false):

  • props: on the board, the platform config and the project config (so tscircuit.config.json can set it), next to schematicDisabled;
  • core: IsolatedCircuit.schematicTraceRoutingDisabled with the same precedence as schematicDisabled (circuit override → platform → board prop), and one early return in each routing entry point right after its schematicDisabled check: Group_doInitialSchematicTraceRender, Trace_doInitialSchematicTraceRender (display-label routing is only reached from it), NetLabel.doInitialSchematicTraceRender;
  • cli (follow-up): tsci build --disable-schematic-routing, forwarded like --routing-disabled.

Open question: with routing disabled, should schematic_port.is_connected be set from source_trace connectivity, so viewers keep showing connected ports?

We have the props and core changes ready (core: 29 lines plus a test that renders one design with and without the option and checks the differences listed above; props: the field, a parse test and the regenerated docs) and are happy to open them as PRs if this direction is acceptable.

Lingua principale
TypeScript
Stelle
61
Fork
256
Merge medio
20h 21m
PR unite (30g)
289

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tscircuit/core

Tutte le issue di tscircuit/core

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.