> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atopile.io/llms.txt
> Use this file to discover all available pages before exploring further.

# 6. Layout

`ato` code defines the function of the circuit via the connections between elements. Unlike a software compiler, these components all need to end up placed somewhere and copper traces need routing between the elements for the circuit to function.

This process is typically called "layout."

atopile uses [KiCad](https://kicad.org), the premier open source electronics design package for layout.

## Opening KiCad

When you run `ato build`, `ato` generates a KiCad project file for you. If you're only building a single build-target, `ato` will open the KiCAD file for you.

## KiCad plugin

The `ato` compiler automatically installs a KiCad plugin to help you with layout. This saves a lot of time.

The plugin installs automatically when you run the `ato` command-line tool, but in case something went wrong, you can re-trigger the installation by running `ato configure`.

## Start with existing packages

If you import the `rp2040` module installed in the [previous section](./4-packages), you can reuse its layout.

```ato theme={null}
from "rp2040/RP2040Kit.ato" import RP2040Kit

module App:
    uc = new RP2040Kit
    # Note: I've emptied this module out for brevity.
    # You can decide whether you want to keep the demo voltage divider or not.

```

To reuse a layout from a package:

* run an `ato build`, to make sure the layout syncs with the code
* hit the "Sync Group" button in the KiCad plugin
* select the group you want to sync, and hit the "Pull" (Down arrow) button to pull the layout from the module's KiCad layout file

<video autoplay loop muted playsinline>
  <source src="https://mintcdn.com/atopile/DwBxr5aqA-UPK0qU/atopile-0.14.x/essentials/assets/5-pcb-layout-sync.mp4?fit=max&auto=format&n=DwBxr5aqA-UPK0qU&q=85&s=5d9090cb219b4058b443087c89a15707" type="video/mp4" data-path="atopile-0.14.x/essentials/assets/5-pcb-layout-sync.mp4" />

  <img src="https://mintcdn.com/atopile/DwBxr5aqA-UPK0qU/atopile-0.14.x/essentials/assets/5-pcb-layout-sync.gif?s=ec3dc797724b6e2fa7d91e772df397f1" alt="Animated fallback" width="756" height="476" data-path="atopile-0.14.x/essentials/assets/5-pcb-layout-sync.gif" />
</video>

<Note>
  The `ato` compiler will map layouts with a **class or super-class** that **has a build**.

  The `RP2040Kit` in the example is the class, and the `ato.yaml` config file in the `rp2040` package means that there's a layout associated with it.

  If you want to create a reusable layout for a class of your own, the easiest way is to add a new build config with `ato create build`, and then point the newly created [entry](../reference/config.md#builds.entry) at the module you've made.
</Note>

<Tip>
  If the plugin is not available in KiCad, try running `ato configure` to set it up
</Tip>

## Layout the rest of your design

Use KiCad to place-and-route the rest of your design, just like if you got it from the schematic editor.

If you can't find the quality of KiCad docs you need to get started, drop a comment or upvote on this GitHub Issue !882

## Auto-layout 🚀

atopile can do small bits of auto-layout for you, but it's not fully exposed to `ato` yet.

If this is a feature that'd super-charge your workflow, please come vote and discuss it in the [GitHub Discussion](https://github.com/atopile/atopile/discussions/881).
