layers module#

Mapping between JITX conductor indices and Gerber file functions.

LayerModel is the single source of truth for what layer a piece of copper belongs to and which file function names it. It owns no filenames: those are the naming layer’s, and nothing outside format/naming.py builds one.

normalize_layer(layer, conductors)[source]#

Resolve a JITX layer index to an absolute one with 0 at the top.

Negative indices count from the bottom, as everywhere else in jitx.

Return type:

int

Parameters:
  • layer (int)

  • conductors (int)

class LayerModel(conductors)[source]#

Bases: object

Conductor indices, sides and the file functions that describe them.

Parameters:

conductors (int) – number of conductor layers in the stackup.

conductors: int#
normalize(layer)[source]#

Absolute conductor index, 0 at the top.

Raises:

IndexError – the index is outside the stackup.

Return type:

int

Parameters:

layer (int)

side(layer)[source]#

Whether a conductor is the top, the bottom, or an inner layer.

Return type:

Side

Parameters:

layer (int)

copper(layer)[source]#

The Copper,L<n>,<side> function for a conductor.

The index in the attribute is 1-based, counted from the top, while every index this class takes is 0-based; the conversion happens here and nowhere else.

Return type:

Copper

Parameters:

layer (int)

span(start, stop)[source]#

A drill span as an ordered pair of absolute indices.

Return type:

tuple[int, int]

Parameters:
drill(span, *, plated)[source]#

The drill file function for a span.

Classification is by reach: a span covering the whole board is PTH or NPTH, one touching exactly one outer layer is Blind, and one touching neither is Buried. The i,j fields are 1-based, as the attribute requires.

Return type:

Drill

Parameters:
property through: tuple[int, int]#

The span crossing the whole board.