Skip to main content

Using Layout Properties

Overview

There are many ways to layout your schematic and PCB with tscircuit including automatic layout and manual edits. In this article we'll discuss how to programmatically lay out a board using layout properties like schX/schY and pcbX and pcbY

All position properties default to mm but you can pass a string with any distance unit. For example, pcbX="0.1in" is the same as pcbX="2.54mm".

PCB Layout Properties

The following properties can be placed on nearly any tscircuit element to control its position on the board:

PropertyDescriptionExample Value
pcbXSet the center X position of the element0
pcbYSet the center Y position of the element0
pcbRotationSet the rotation of the element"90deg"

Here's an example of moving a resistor with default properties versus custom layout properties:

export default () => (
<resistor
name="R1"
footprint="0805"
resistance="1k"
/>
)
PCB Circuit Preview
export default () => (
<resistor
name="R1"
footprint="0805"
resistance="1k"
pcbX="3mm"
pcbY="2.5mm"
pcbRotation="90deg"
/>
)
PCB Circuit Preview
info

To see positions and measure distances in the PCB Viewer, you can press "d" on your keyboard to toggle measurement mode.

PCB Viewer Measurement Mode
PCB Viewer Measurement Mode, press "d" to toggle when using the PCB tool

Schematic Layout Properties

The following properties can be placed on a schematic element to control its position on the board:

PropertyDescriptionExample Value
schXSet the center X position of the element0
schYSet the center Y position of the element0
schRotationSet the rotation of the element"90deg"

Here's an example of moving a resistor with default properties versus custom schematic layout properties:

export default () => (
<resistor
name="R1"
footprint="0805"
resistance="1k"
/>
)
Schematic Circuit Preview
export default () => (
<resistor
name="R1"
footprint="0805"
resistance="1k"
// schX="3mm"
// schY="2.5mm"
schRotation="90deg"
/>
)
Schematic Circuit Preview