Skip to content

Place the parts ​

A part definition gives a component its value, connections and footprint. A placement gives that footprint a position on this board. In pcb.tsx, find J1, Q1 and C1:

Individual placementsCompiled from the source below
Highlighted lines are this step’s focus
// Individual placements. Coordinates are millimetres, x right and y down.
import PCB, { route, pour, via } from '@pcbjs/core'
import { Brand, rect, roundedRect } from '@pcbjs/lib'
import * as sch from './blinky.sch'
import './blinky.sourcing'

const W = 30,
  H = 20

export default (
  <PCB name="Blinky" rev="0.1.0" schematic={sch} rules={{ clearance: 0.2, minTrackWidth: 0.2, requireSourcing: true }} autoroute={{ bend: '45', viaCost: 4 }}>
    <path layer="Edge.Cuts" d={roundedRect(W, H, 2)} />

    <J1 at="3 8" />
    <Q1 at="26 10" />

    <C1 at="15 10" side="B" />

  </PCB>
)
3 placed parts · 0 tracks

Hover the source lines or drawing to connect each placement with the object it draws. Use the full viewer to inspect pads and nets.

Read a position ​

at="3 8" places J1's footprint origin at x = 3 mm, y = 8 mm. The origin belongs to the footprint definition; it need not be its geometric centre. at can include a third value for rotation, such as "15 10 90deg".

side="B" puts C1 on the back. It remains the same C1 defined in the schematic, with the same nets. Switch sides in the 2D viewer or rotate the 3D view to inspect it. In Blinky, this keeps C1 out of the front-side LED track's way.

A placed part normally brings its pads, courtyard, silk reference and 3D body together. Use ref:at when only its generated reference label needs a different position. The finished Blinky adds explicit back silk text for C1 later.

Place repeated channels as rows ​

lib/led-channel.tsx exports schematic, layout and layoutStack. The layouts are declared with schematic.layout(render, name). The board imports layout as LedChannelRow, keeping its JSX readable.

The three LedChannelRow elements place CH1, CH2 and CH3 at x = 16 mm, y = 5, 10 and 15 mm. Inside each row, the resistor is at x = −4 mm and the LED at x = +4 mm. Their midpoint is the local grid origin. The row's placement carries the board offset, while its parts and short tracks use local coordinates. Moving or rotating a row moves that arrangement around its own origin.

Reusable channel placementsCompiled from the source below
Highlighted lines are this step’s focus
// Reusable channel placements. Coordinates are millimetres, x right and y down.
import PCB, { route, pour, via } from '@pcbjs/core'
import { Brand, rect, roundedRect } from '@pcbjs/lib'
import * as sch from './blinky.sch'
import './blinky.sourcing'
import { layout as LedChannelRow } from './lib/led-channel'

const W = 30,
  H = 20

export default (
  <PCB name="Blinky" rev="0.1.0" schematic={sch} rules={{ clearance: 0.2, minTrackWidth: 0.2, requireSourcing: true }} autoroute={{ bend: '45', viaCost: 4 }}>
    <path layer="Edge.Cuts" d={roundedRect(W, H, 2)} />

    <J1 at="3 8" />
    <Q1 at="26 10" />
    <LedChannelRow g={CH1} at="16 5" label="LED1" />
    <LedChannelRow g={CH2} at="16 10" label="LED2" />
    <LedChannelRow g={CH3} at="16 15" label="LED3" />
    <C1 at="15 10" side="B" />

  </PCB>
)
9 placed parts · 0 tracks

For this first board, keep that shared layout and adjust the board-level placements. Reusable layouts explains how to author the row itself when you are ready.

Make one small move ​

Move J1 a small distance to the right, save pcb.tsx and inspect the changed position. Run:

sh
npx pcbjs inspect J1
npx pcbjs check

inspect reports the footprint and pad positions in board coordinates. A position change can affect routes and clearance, so compare the drawing and the findings. Restore J1's original position before following the routing lesson, whose coordinates refer to the supplied layout.

Next: Route the connections. See Layout reference for placement elements and Placement tools for automatic placement.

MIT licensed. A proof of concept, pre 0.1.