copperpour `outline` is shrunk by `boardEdgeMargin` (default: `clearance`), which is not documented
Maintainers usually reply within 1 day
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 buildabove: 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-pourandcopperpour-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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tscircuit/core
-
Standalone `import("@tscircuit/core")` fails with `ERR_MODULE_NOT_FOUND` due to `devDependencies`-only imports in `dist/`Possibly taken @Andresdev14 claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
tscircuit/core#5508 · 1 comment ·
Maintainers usually reply within 1 day
-
Default solder paste aperture is 0.7x the pad (49% of its area)Possibly taken @zainrizvi0611-cmd claimed this 16 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
tscircuit/core#4800 · 1 comment ·
Maintainers usually reply within 1 day
-
SCHEMATIC_COMPONENT_OUTLINE_COLOR "rgba(132, 0, 0)" is not portable SVG color; strict SVG renderers reject schematic outputPossibly taken @zainrizvi0611-cmd claimed this 17 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Maintainers usually reply within 1 day
-
Scientific notation is truncated in simulation graph scale and offset settingsPossibly taken @Crodify claimed this 9 days ago. Openno-issue-activity
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
tscircuit/core#3732 · 1 comment ·
Maintainers usually reply within 1 day
-
SchematicRect drops fillColor from circuit JSON and renders filled rectangles with the stroke colorPossibly taken @cocvn157 claimed this 11 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
openclaw/openclaw#199885 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
feature needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
BoardGamesEmpire/board-games-empire-backend#1306 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
sequant-io/sequant#1689 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100