# Copper

The `copper` statement defines geometry on a specified copper layer of the board stackup.

This statement can be used in the following contexts:

## Signature

``````  copper(<LAYER-INDEX>) = <Shape>
``````
• `&lt;LAYER-INDEX>` - This expects a LayerIndex instance to select which copper layer to apply the created geometry.
• `&lt;Shape>` - The geometric Shape to create in this copper layer.

## Usage

That are two contexts in which the `copper` statement can be used. In each context, the usage is slightly different.

### Land Pattern Context

In the `pcb-landpattern` context, the `copper` statement can be used standalone. This statement is used to create copper structures like an antenna in a landpattern. For example, see the ant-2GHz4-inverted-f-geom land pattern - here is an excerpt:

``````pcb-landpattern ant-2GHz4-inverted-f-geom :

copper(LayerIndex(0)) = Line(0.5, [Point(-2.1, 5.15), Point(2.2, 5.15), Point(2.2, 2.51),
Point(4.7, 2.51),  Point(4.7, 5.15), Point(6.9, 5.15),
Point(6.9, 2.51),  Point(9.4, 2.51), Point(9.4, 5.15),
Point(11.6, 5.15), Point(11.6, 0.96)])
copper(LayerIndex(0)) = Line(0.5, [Point(0.0, 0.0),   Point(0.0, 5.15)])
copper(LayerIndex(0)) = Rectangle(0.9, 5.4, loc(-2.1, 2.7))
...
``````

This will generate a shape that looks like this:

In the following image the 2nd and 3rd `copper` statements are drawn in a different color to show their position in relation to the pads of this landpattern:

### Geom/Module Context

In the `pcb-module` context, the `copper` statement can be used from within a geom statement. The `geom` statement provides the net to which this copper geometry will be assigned. The most common usage of this statement is defining ground planes or similar geometry with explicit shapes:

``````val board-shape = Rectangle(30.0, 40.0)

pcb-module top-level:
...

geom(GND):
val sh = offset{_, -1.0} \$ RoundedRectangle(30.0, 10.0, 3.0)
copper(LayerIndex(0, Bottom)) = loc(0.0, -15.0) * sh
``````

Notice the use of offset to shrink the `RoundedRectangle` shape by 1mm. The loc function is used to transform the shrunken shape into position in the lower half of the PCB.

Constructs a shape on the bottom layer with geometry like this:

## Syntax

``````geom(my-net):
copper(LayerIndex(0)) = Circle(0.0, 15.0, 1.0)
copper(LayerIndex(1)) = Line(1.0, [Point(0.0, -5.0) Point(5.0, -5.0)])
``````

## Description

• `copper(LayerIndex(0)) = Circle(0.0, 15.0, 1.0)` Create a copper circle at (x,y) = (0,15mm) of radius 1mm. You can use any Shape with the `copper` statement.
• `copper(LayerIndex(1)) = Line(1.0, [Point(0.0, -5.0) Point(5.0, -5.0)])` Create a 1mm wide copper line (results in a trace) on the 2nd copper layer from the top.