copperpour `outline` is shrunk by `boardEdgeMargin` (default: `clearance`), which is not documented

Open
#5,506 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Andresdev14 is already working on this.

Since Nov 15, 2026.

  • #5512 by @Andresdev14 — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
34/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
react, typescript
Domain
tooling

Research direction

Read lib/components/primitive-components/CopperPour/CopperPour_doInitialPcbCopperPourRender.ts around lines 81-84, where board_edge_margin falls back to clearance and board_edge_outline is passed only for implicit pours, then the solver's lib/solvers/CopperPourPipelineSolver.ts in copper-pour-solver to see both margin applications. Start by running the reproduction and bun test tests/ -t "opper". Done means a maintainer decision between passing board_edge_outline for every pour and updating the three failing snapshots, or documenting the inset. Note #5512 is already open against this.

Written by the indexing model from the issue text.

Description

What happens

A <copperpour outline={...} /> produces copper that is inset from the given outline by boardEdgeMargin, which falls back to clearance (0.2 mm by default), even when the outline is nowhere near the board edge. Parts of the outline narrower than twice the margin disappear.

Reproduction

pour-outline.circuit.tsx:

export default () => (
  <board width="20mm" height="20mm" routingDisabled>
    <net name="GND" />
    <copperpour
      connectsTo="net.GND"
      layer="top"
      clearance="0.5mm"
      outline={[
        { x: -2, y: -2 },
        { x: 2, y: -2 },
        { x: 2, y: 2 },
        { x: -2, y: 2 },
      ]}
    />
  </board>
)
bunx tsci build pour-outline.circuit.tsx --disable-parts-engine

Expected

A 4 x 4 mm pour. Nothing else is on the board and the board edge is 8 mm away.

Actual

A 3 x 3 mm pour. pcb_copper_pour.brep_shape.outer_ring.vertices in circuit.json:

(1.5, -1.5) (-1.5, -1.5) (-1.5, 1.5) (1.5, 1.5)

Adding boardEdgeMargin="0mm" gives the 4 x 4 mm pour:

(2, -2) (-2, -2) (-2, 2) (2, 2)

A narrow neck is removed. Here a GND pour is meant to join two GND pads through a 0.3 mm wide neck:

pour-neck.circuit.tsx
export default () => (
  <board width="20mm" height="10mm" routingDisabled>
    <resistor name="R1" resistance="1k" footprint="0402" pcbX={-4} connections={{ pin2: "net.GND" }} />
    <resistor name="R2" resistance="1k" footprint="0402" pcbX={4} connections={{ pin1: "net.GND" }} />
    <copperpour
      connectsTo="net.GND"
      layer="top"
      clearance="0.2mm"
      outline={[
        { x: -4, y: -1 },
        { x: -2, y: -1 },
        { x: -2, y: -0.15 },
        { x: 2, y: -0.15 },
        { x: 2, y: -1 },
        { x: 4, y: -1 },
        { x: 4, y: 1 },
        { x: 2, y: 1 },
        { x: 2, y: 0.15 },
        { x: -2, y: 0.15 },
        { x: -2, y: 1 },
        { x: -4, y: 1 },
      ]}
    />
  </board>
)

It comes out as two separate pours, x = -3.8 to -2.2 and x = 2.2 to 3.8. The build exits 0. It only warns that the unconnected pins (R1 pin1, R2 pin2) have no traces; nothing reports that the GND pour was split.

Versions

  • tsci build above: tscircuit 0.0.3161 (@tscircuit/cli 0.1.2454, @tscircuit/core 0.0.2343, @tscircuit/copper-pour-solver 0.0.74), Bun 1.4.4, Linux.
  • Also checked on core main 27a7479 (v0.0.2378) with copper-pour-solver 0.0.74: the same three circuits as a getTestFixture() test give the same vertices.

Cause

Core passes board_edge_margin: props.boardEdgeMargin ?? clearance, and passes board_edge_outline only for implicit pours:
https://github.com/tscircuit/core/blob/27a7479563947dc410454a428654f7cefbad9603/lib/components/primitive-components/CopperPour/CopperPour_doInitialPcbCopperPourRender.ts#L81-L84

Without board_edge_outline, the solver applies the board-edge margin to the region's own outline:
https://github.com/tscircuit/copper-pour-solver/blob/d7d3018f72357f1e7cb435e419e76a430c3ca926/lib/solvers/CopperPourPipelineSolver.ts#L67-L73

Since copper-pour-solver#126, the solver also clips every pour to the board outline less the same margin:
https://github.com/tscircuit/copper-pour-solver/blob/d7d3018f72357f1e7cb435e419e76a430c3ca926/lib/solvers/CopperPourPipelineSolver.ts#L94-L105

So for an explicit pour the margin is applied to two boundaries: the board edge and the pour's own outline.

The solver's types already separate the two. boardEdgeOutline is "used to apply board-edge clearance independently from a custom clipping outline", and boardOutline "Does not replace the region margin outline":
https://github.com/tscircuit/copper-pour-solver/blob/d7d3018f72357f1e7cb435e419e76a430c3ca926/lib/types.ts#L8-L17

Core just doesn't pass board_edge_outline for explicit pours.

The docs describe boardEdgeMargin as "Minimum distance from the board edge" and outline as "Optional polygon describing a custom pour boundary":
https://github.com/tscircuit/docs/blob/470bab2597218cf3ed27d919e8b1c3695ea4a202/docs/elements/copperpour.mdx?plain=1#L121-L124

Related

core#4703 (closed) reported that explicit pours ignore the real board edge, noted that boardEdgeMargin is applied to the pour's own outline, and suggested passing board_edge_outline for all pours. It was fixed in the solver by copper-pour-solver#126 instead, which adds the board clipping while keeping the existing region margins ("preserving region margins"). So the board-edge half is fixed. This issue is about the other half: the inset of the pour's own outline. I couldn't tell whether keeping that inset was meant as user-facing behaviour or only kept to avoid changing existing output.

Suggestion

Either pass board_edge_outline: resolvedPcbBoardOutline for explicit pours too, as core#4703 suggested, or document that outline is inset by boardEdgeMargin (default clearance).

I tried the first option on core main by passing board_edge_outline for every pour:

  • The 4 x 4 mm case gives the 4 x 4 mm pour.
  • The neck case gives one pour.
  • An outline that crosses the board edge (x = 8 to 12 on the 20 mm board, clearance="0.5mm") is still clipped at x = 9.5.
  • bun test tests/ -t "opper": 3 of 71 tests fail, all on PCB snapshots (diffs of 0.81 %, 0.89 % and 4.74 %): repro172-different-net-copper-pour-overlap, keepout-warning-only-copper-pour and copperpour-multiple-outlines. I haven't looked at the diff images, so I don't know whether every change there is only the pours growing to their outlines.

It also changes output for existing designs: pours grow by the margin wherever the outline is not limited by other clearances.


AI-assisted: I used Claude Code to read the source, run the reproduction above and draft this report.

Dominant language
TypeScript
Stars
61
Forks
256
Avg merge
20h 21m
Merged PRs (30d)
289

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from tscircuit/core

All issues in tscircuit/core

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.