jobfile module#

Write the .gbrjob job file (spec 2020.08, JSON schema 2023.06).

The job file is the glue that lets CAM import a file set without guessing, so it is written from the first release rather than treated as an extra.

Its Path values are the final resolved filenames, which means naming runs before this writer does and the caller hands over the resolved set rather than anything here re-deriving a name.

class StackupType(*values)[source]#

Bases: StrEnum

MaterialStackup row types.

Soldermask and legend rows exist so a stackup layer that declares itself one is not mislabeled dielectric, which is what a “everything that is not a conductor is a dielectric” walk produces.

COPPER = 'Copper'#
DIELECTRIC = 'Dielectric'#
SOLDERMASK = 'SolderMask'#
LEGEND = 'Legend'#
SURFACE_FINISH = 'SurfaceFinish'#
class StackupRow(type, thickness=None, name=None, material=None, dielectric_constant=None, loss_tangent=None)[source]#

Bases: object

One MaterialStackup entry, top to bottom. Thickness in mm.

Parameters:
type: StackupType#
thickness: float | None = None#
name: str | None = None#
material: str | None = None#
dielectric_constant: float | None = None#
loss_tangent: float | None = None#
class FileEntry(path, function, polarity=None, file_format=None)[source]#

Bases: object

One FilesAttributes entry.

Parameters:
  • path (str) – the resolved filename, as written to disk.

  • file_format (str | None) – XNC for a drill file; omitted for Gerber, whose format is implied.

  • function (FileFunction)

  • polarity (FilePolarity | None)

path: str#
function: Copper | Soldermask | Legend | Paste | Profile | Drill | Component | Job#
polarity: FilePolarity | None = None#
file_format: str | None = None#
class JobFile(size, conductors, thickness=None, stackup=list(), files=list())[source]#

Bases: object

The job file model.

Parameters:
  • size (tuple[float, float]) – board extent (X, Y) in mm, from the profile bounding box.

  • conductors (int) – LayerNumber, the conductor count.

  • thickness (float | None) – BoardThickness in mm, summed over the stackup where every material declares one.

  • stackup (list[StackupRow])

  • files (list[FileEntry])

size: tuple[float, float]#
conductors: int#
thickness: float | None = None#
stackup: list[StackupRow]#
files: list[FileEntry]#
project_guid(name)[source]#

A stable GUID for a design name.

uuid5 gives determinism across reruns, but the spec requires an RFC 4122 version 1 or 4 GUID and a uuid5 carries a version 5 nibble, so the version and variant nibbles are forced to v4 afterwards.

Return type:

str

Parameters:

name (str)

emit_jobfile(job, meta)[source]#

The complete text of the .gbrjob file.

Return type:

str

Parameters: