Skip to content

jitx/layer-specs

Package name: jitx/layer-specs

Summary

Data Types

CustomLayer

Constructors

Function Description
CustomLayer Constructor for defstruct CustomLayer

Silkscreen

Constructors

Function Description
Silkscreen Constructor for defstruct Silkscreen

LayerIndex

The LayerIndex type is used to specify which conductor layer in the board stackup that a particular statement or property affects.

Constructors

Function Description
LayerIndex Constructor for defstruct LayerIndex

Functions

Function Description
layer-num
to-layer-index
flip
layer-pair

Operators

Function Op. Description
minus (+ 1) -
plus (+ 1) +

BoardEdge

Constructors

Function Description
BoardEdge Constructor for defstruct BoardEdge

Courtyard

Constructors

Function Description
Courtyard Constructor for defstruct Courtyard

Cutout

Constructors

Function Description
Cutout Constructor for defstruct Cutout

LayerSpecifier

The LayerSpecifier type is the base type for specifying non-copper manufacturing layers.

Functions

Function Description
flip

SolderMask

Constructors

Function Description
SolderMask Constructor for defstruct SolderMask

ForbidCopper

Constructors

Function Description
ForbidCopper Constructor for defstruct ForbidCopper

LayerShape

Constructors

Function Description
LayerShape Constructor for defstruct LayerShape

Paste

Constructors

Function Description
Paste Constructor for defstruct Paste

Finish

Constructors

Function Description
Finish Constructor for defstruct Finish

Glue

Constructors

Function Description
Glue Constructor for defstruct Glue

Side

Enum to represent which side of the board a component or module is placed on.

Functions

Function Description
to-layer-index
flip (+ 2)

Operators

Function Op. Description
minus -
plus +

ForbidVia

Constructors

Function Description
ForbidVia Constructor for defstruct ForbidVia

Definitions

CustomLayer

public defstruct CustomLayer <: LayerSpecifier
    name: String
    side: Side

  • name: String

  • side: Side

Constructors

CustomLayer

Constructor for defstruct CustomLayer

public defn CustomLayer (name:String, side:Side = ?)

Silkscreen

public defstruct Silkscreen <: LayerSpecifier
    name: String
    side: Side

  • name: String

  • side: Side

Constructors

Silkscreen

Constructor for defstruct Silkscreen

public defn Silkscreen (name:String = ?, side:Side)

LayerIndex

The LayerIndex type is used to specify which conductor layer in the board stackup that a particular statement or property affects.

public defstruct LayerIndex <: Hashable & Equalable & Comparable<LayerIndex>
    index: Int
    side: Side

  • index: Int

  • side: Side

Outline

defstruct LayerIndex :
  index:Int
  side:Side

defn LayerIndex (index:Int, side:Side = Top) -> LayerIndex:
  ...

The LayerIndex type expects two arguments:

  1. index - If we consider the conductor layers in board stackup an zero-indexed array, the index is the offset into the array from either the Top or the Bottom.
  2. side - This parameter determines whether the index applies from the Top going down, or from the Bottom going up.

Symmetry of Top and Bottom Indices

The Bottom side indices can be considered a reverse indexing scheme.

Layer Indices

Notice that there is a way to index every layer in the stackup in either direction.

Shortcuts based on Side

In some applications of the LayerIndex type, you will often see the type LayerIndex|Side used. This means that the user can pass either a LayerIndex or a Side parameter in the form of Top or Bottom enumerated values.

These Side values are a shortcut for:

  1. Top => LayerIndex(0, Top)
  2. Bottom => LayerIndex(0, Bottom)

Operators

Currently the plus and minus operators are defined for the LayerIndex and Side types. This provides a short cut for indexing:

val inner-1 = Top + 1
println("Inner 1: %_" % [inner-1])

val inner-N-1 = Bottom - 1
println("Inner N-1: %_" % [inner-N-1])

val inner-skip = inner-1 + 2
println("Inner Skip: %_" % [inner-skip])

When run this will generate:

Inner 1: LayerIndex(1)
Inner N-1: LayerIndex(1, Bottom)
Inner Skip: LayerIndex(3)

Constructors

LayerIndex

Constructor for defstruct LayerIndex

public defn LayerIndex (index:Int, side:Side = ?)

Functions

layer-num

public defn layer-num (l:LayerIndex, num-copper-layers:Int)

to-layer-index

public defn to-layer-index (l:LayerIndex|Side) -> LayerIndex

  • Returns LayerIndex

flip

public defn flip (a:Side, l:LayerIndex)

layer-pair

public defn layer-pair (l0:LayerIndex, l1:LayerIndex) -> [LayerIndex, LayerIndex]

  • Returns [LayerIndex, LayerIndex]

Operators

minus -

public defn minus (l:LayerIndex, i:Int) -> LayerIndex

  • Returns LayerIndex

minus -

public defn minus (side:Side, index:Int) -> LayerIndex

  • Returns LayerIndex

plus +

public defn plus (l:LayerIndex, i:Int) -> LayerIndex

  • Returns LayerIndex

plus +

public defn plus (side:Side, index:Int) -> LayerIndex

  • Returns LayerIndex

BoardEdge

public defstruct BoardEdge <: LayerSpecifier

Constructors

BoardEdge

Constructor for defstruct BoardEdge

public defn BoardEdge ()

Courtyard

public defstruct Courtyard <: LayerSpecifier
    side: Side

  • side: Side

Constructors

Courtyard

Constructor for defstruct Courtyard

public defn Courtyard (side:Side)

Cutout

public defstruct Cutout <: LayerSpecifier

Constructors

Cutout

Constructor for defstruct Cutout

public defn Cutout ()

LayerSpecifier

The LayerSpecifier type is the base type for specifying non-copper manufacturing layers.

public deftype LayerSpecifier <: Equalable & Hashable

This typically includes the silkscreen, solder mask, forbidden regions, etc. It is not used to specify geometry on copper layers.

Derived Types

LayerSpecifier is the parent to multiple child types. The child types defined below are what we typically use with the layer() statement.

Name Description
Courtyard(s:Side) Courtyard layer to indicate land pattern bounds. Expects a Top&vert;Bottom argument.
Cutout() Cutout layer for holes and slots. Vias and through-hole pads will include their hole definitions on this layer.
SolderMask(s:Side) Solder mask layer. Expects a Top&vert;Bottom argument.
Paste(s:Side) Paste application layer. Expects a Top&vert;Bottom argument.
Glue(s:Side) Glue application layer. Expects a Top&vert;Bottom argument.
Finish(s:Side) Surface Finish layer to indicate plating. Expects a Top&vert;Bottom argument.
Silkscreen(s:Side) Silkscreen application layer. Expects a Top&vert;Bottom argument.
BoardEdge() Geometry to align with edge of board
ForbidVia() Forbid Vias layer (via keepout)
ForbidCopper( start:LayerIndex, end:LayerIndex) Forbid Copper layer (copper keepout). Expects a LayerIndex argument to specify which layer[s] to forbid copper.
CustomLayer( name:String, s:Side) Custom Mechanical layer. Expects a name and a Top&vert;Bottom argument.

Cutout

The Cutout layer is intended to make internal holes in the board shape, like for through holes or routed holes/slots.

While you can use any geometry on the Cutout layer - keep in mind your fabricator's limitations and constraints. If your fabricator only has a router (and not a laser or waterjet cutter) then they will likely not be able to construct a hole with squared corners.

Silkscreen

defstruct Silkscreen <: LayerSpecifier:
  name:String with:
    default => "default-silkscreen"
  side:Side

This layer optionally allows for a name:String argument with default value of default-silkscreen. This name acts like a class attribute in HTML. It is intended to group like content together on the silkscreen layers.

When the board data is exported, the silkscreen content for the top and bottom layers, respectively, will be flattened into a single top and bottom silkscreen layers.

The typical usage model is to use the default value and create layer specificiers with Silkscreen(Top) or Silkscreen(Bottom) and no custom name.

CustomLayer

Similarly, the CustomLayer specifier expects a name:String argument. This argument allows the user to specify different classes of content like:

  • Fabrication Notes
  • Assembly Notes
  • Dimensions

ForbidCopper

The ForbidCopper specifier takes a LayerIndex instance[s] as an argument. This allows you to construct keepout regions for the copper on any layer or set of layers in a design.

defn ForbidCopper (start:LayerIndex, end:LayerIndex = start) -> ForbidCopper :
  ...

Notice that the end by default is start. If you construct a ForbidCopper() with a single argument, then only that copper layer will possess a forbidden region.

Let's consider a case where we have an antenna on a N-layer board:

Antenna Example

And we want to place a forbid region in the blue area of the board.

pcb-board curr-board:
  ...
  val forbid-range = ForbidCopper(
    LayerIndex(1), LayerIndex(0, Bottom)
  )
  layer(forbid-range) = loc(40.0, 0.0) * Rectangle(10.0, 30.0)

Here we construct a ForbidCopper instance that spans the layer 1 to N. Notice that we don't include the layer 0 or the Top layer because that is where the antenna structure will go. The LayerIndex(0, Bottom) is a means of specifying the bottom copper layer of the board without knowing the full number of layers in the stackup.

We then use the loc() function to position the desired forbid region on the board. This takes our 10mm x 30mm forbid region and translates it 40mm to right from the origin of the board.

Functions

flip

public defn flip (a:Side, l:LayerSpecifier)

SolderMask

public defstruct SolderMask <: LayerSpecifier
    side: Side

  • side: Side

Constructors

SolderMask

Constructor for defstruct SolderMask

public defn SolderMask (side:Side)

ForbidCopper

public defstruct ForbidCopper <: LayerSpecifier
    end: LayerIndex
    start: LayerIndex

  • end: LayerIndex

  • start: LayerIndex

Constructors

ForbidCopper

Constructor for defstruct ForbidCopper

public defn ForbidCopper (start:LayerIndex, end:LayerIndex = ?)

LayerShape

public defstruct LayerShape <: Hashable & Equalable
    shape: Shape
    specifier: LayerSpecifier

  • shape: Shape

  • specifier: LayerSpecifier

Constructors

LayerShape

Constructor for defstruct LayerShape

public defn LayerShape (specifier:LayerSpecifier, shape:Shape)

Paste

public defstruct Paste <: LayerSpecifier
    side: Side

  • side: Side

Constructors

Paste

Constructor for defstruct Paste

public defn Paste (side:Side)

Finish

public defstruct Finish <: LayerSpecifier
    side: Side

  • side: Side

Constructors

Finish

Constructor for defstruct Finish

public defn Finish (side:Side)

Glue

public defstruct Glue <: LayerSpecifier
    side: Side

  • side: Side

Constructors

Glue

Constructor for defstruct Glue

public defn Glue (side:Side)

Side

Enum to represent which side of the board a component or module is placed on.

public defenum Side <: Equalable & Hashable

  • Top - top of the board, or same side as the reference placement

  • Bottom - bottom of the board, or opposite side as the reference placement

Note that in some contexts the interpretation is relative; for example if a module is placed on Bottom but it has a component which is placed relatively to that module on Bottom, that component will actually be on Top overall.

Functions

to-layer-index

public defn to-layer-index (l:LayerIndex|Side) -> LayerIndex

  • Returns LayerIndex

flip

public defn flip (a:Side, b:Side)

flip

public defn flip (a:Side, l:LayerSpecifier)

flip

public defn flip (a:Side, l:LayerIndex)

Operators

minus -

public defn minus (side:Side, index:Int) -> LayerIndex

  • Returns LayerIndex

plus +

public defn plus (side:Side, index:Int) -> LayerIndex

  • Returns LayerIndex

ForbidVia

public defstruct ForbidVia <: LayerSpecifier

Constructors

ForbidVia

Constructor for defstruct ForbidVia

public defn ForbidVia ()

Related Packages

Forwarded by package: jitx