Layer

layer is used to create geometry on the manufacturing layers of a circuit board. Layers can be used inside pcb-landpattern, and pcb-module.

Syntax

layer(Courtyard(Top)) = Rectangle(3.0, 2.0)
layer(SolderMask(Top)) = Rectangle(anchor, w, h)
layer(Silkscreen("values", Top)) = Text(">REF", 1.0, a, loc(x,y))
layer(Silkscreen("f-silk", Top)) = LineRectangle(1.5, 3.0)
layer(Silkscreen("pol", Top)) = Circle(x0, y0, 0.254)

layer(ForbidCopper(LayerIndex(n)))
layer(ForbidCopper(LayerIndex(2,Bottom)))
layer(ForbidCopper(LayerIndex(0), LayerIndex(2)))
layer(ForbidCopper(LayerIndex(0), LayerIndex(0, Bottom)))

Description

  • layer(Courtyard(Top)) = Rectangle(3.0, 2.0) Define a 3mmx2mm Rectangle on the top courtyard layer. This would define the bounds of an SMD land pattern.
  • layer(SolderMask(Top)) = Rectangle(w, h) Define a w x h Rectangle on the top soldermask layer, as used to define soldermask for a pad.
  • layer(Silkscreen("values", Top)) = Text(">REF", 1.0, a, loc(x,y)) Add 1mm high text saying ">REF" to the top silkscreen layer, anchored at a and located at (x,y). "values" is used to specify the intent of the text; all silkscreen on the top layer will get flattened to a single silkscreen layer in CAD export.
  • layer(Silkscreen("f-silk", Top)) = LineRectangle(1.5, 3.0) Add a 1.5mmx3mm rectangular outline to the top silkscreen.
  • layer(Silkscreen("pol", Top)) = Circle(x0, y0, 0.254) Add a circular polarity marker to the top silkscreen.

We can create geometry on the copper layers in our board using the LayerIndex function. For example, here's how to create a keepout:

  • layer(ForbidCopper(LayerIndex(2))) Forbid Copper on third layer from top
  • layer(ForbidCopper(LayerIndex(2,Bottom))) Forbid Copper on third layer from bottom
  • layer(ForbidCopper(LayerIndex(0), LayerIndex(2))) Forbid Copper on top three layers
  • layer(ForbidCopper(LayerIndex(0), LayerIndex(0, Bottom))) Forbid Copper on all layers

All layer specifiers

NameDescription
Courtyard(Top)Top Courtyard layer to indicate land pattern bounds
Courtyard(Bottom)Bottom Courtyard layer to indicate land pattern bounds
Cutout()Cutout layer for holes and slots
SolderMask(Top)Top SolderMask layer
SolderMask(Bottom)Bottom SolderMask layer
Paste(Top)Top Paste layer
Paste(Bottom)Bottom Paste layer
Glue(Top)Top Glue layer
Glue(Bottom)Bottom Glue layer
Finish(Top)Top Finish layer to indicate plating
Finish(Bottom)Bottom Finish layer to indicate plating
Silkscreen("MyGraphics", Top)Top Silkscreen layer
Silkscreen("MyGraphics", Bottom)Bottom Silkscreen layer
BoardEdge()Geometry to align with edge of board
ForbidVia()Forbid Vias layer (via keepout)
ForbidCopper()Forbid Copper layer (copper keepout)
CustomLayer("Fab", Top)Top Fab layer
CustomLayer("Fab", Bottom)Bottom Fab layer