Generate implicit pcb_copper_pour polygon elements for power nets in Circuit
JSON.
The solver follows the power-trace-expansion algorithm from the supplied JSX artifact:
- Sample a regular grid on each selected copper layer.
- Assign every in-board sample to its nearest net-owned pad, trace, or via.
- Group four-connected cells with the same nearest net.
- Discard regions below the configured minimum area.
- Trace each surviving grid region into a rectilinear polygon.
- Emit polygons only when the owning
source_nethasis_power,is_ground, oris_positive_voltage_sourceset.
import { ImplicitCopperPourPipelineSolver } from "@tscircuit/implicit-copper-pour-solver"
const solver = new ImplicitCopperPourPipelineSolver({
circuitJson,
gridPitch: 0.25,
minRegionArea: 2,
layers: ["top", "bottom"],
})
solver.solve()
const copperPourElements = solver.getOutput()
const circuitJsonWithPours = [...circuitJson, ...copperPourElements]The class extends BasePipelineSolver from @tscircuit/solver-utils and uses
three debugger-visible stages: Circuit JSON preparation, nearest-net grid
assignment, and power polygon tracing.
bun install
bun test
bun run typecheck
bun run format:check
bun run startThe nRF52810 fixture is rendered as a full board before and after solving. The
solved result is also rendered separately for every copper layer. These images
are compared with committed SVG snapshots in tests/__snapshots__. Snapshot
mismatches generate .diff.png files, which CI uploads as artifacts.
Update approved snapshots with:
bun run test:update-snapshots