tscircuit / tscircuit/core

pcbLayout.matchAdapt collapses all PCB components onto the group origin

Open Beginner friendly
#3,136 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
58
Forks
203
Avg merge
7h 39m
Merged PRs (30d)
286

Description

Setting pcbLayout={{ matchAdapt: true }} or matchAdapt on a board or group leaves every PCB component at (0,0), overlapping, instead of laying them out. The same board without the prop packs fine.

Group._getPcbLayoutMode() returns "match-adapt", but Group.doInitialPcbLayout() only dispatches grid, pack and flex, so no PCB layout runs. There is no PCB match-adapt implementation. Schematic match-adapt is unaffected.

Repro

<board width="40mm" height="40mm" routingDisabled pcbLayout={{ matchAdapt: true }}>
  <net name="V" />
  <net name="GND" />
  <resistor name="R1" resistance="1k" footprint="0805" connections={{ pin1: "net.V", pin2: "net.GND" }} />
  <resistor name="R2" resistance="1k" footprint="0805" connections={{ pin1: "net.V", pin2: "net.GND" }} />
  <capacitor name="C1" capacitance="100nF" footprint="0805" connections={{ pin1: "net.V", pin2: "net.GND" }} />
  <capacitor name="C2" capacitance="100nF" footprint="0805" connections={{ pin1: "net.V", pin2: "net.GND" }} />
</board>

After render, db.pcb_component.list() returns four components all centered at (0,0) and the circuit-json contains pcb_courtyard_overlap_error entries. Expected: the components laid out without overlap. Removing the prop packs them to four distinct positions with no overlap.

Suggested fix: dispatch match-adapt to the pack layout (the default PCB auto-layout) until a real PCB match-adapt exists.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Group._getPcbLayoutMode() and Group.doInitialPcbLayout(), then run the TypeScript board reproduction from the issue. Verify that match-adapt selects the default PCB packing behavior and that db.pcb_component.list() contains four distinct positions with no pcb_courtyard_overlap_error entries.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
embedded-iot
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.