This crate implements the basic building blocks of Gerber (RS-274X, aka Extended Gerber version 2) code. It focusses on the low level types and does not do any semantic checking.
For example, you can use an aperture without defining it. This will generate syntactically valid but semantially invalid Gerber code, but this module won't complain.
Minimal required Rust version: 1.31.
There are two main traits that are used for code generation:
GerberCodegenerates a full Gerber code line, terminated with a newline character.
PartialGerberCode(internal only) generates Gerber representation of a value, but does not represent a full line of code.
The coordinate format specifies the number of integer and decimal places in
a coordinate number. For example, the
Coordinate numbers are integers conforming to the rules set by the FS command.
Coordinate offsets can be used for interpolate operations in circular interpolation mode.
Coordinates are part of an operation.
The moiré primitive is a cross hair centered on concentric rings (annuli). Exposure is always on.
A polygon primitive is a regular polygon defined by the number of vertices, the center point and the diameter of the circumscribed circle.
The thermal primitive is a ring (annulus) interrupted by four gaps. Exposure is always on.
All types that implement this trait can be converted to a complete Gerber Code line. Generated code should end with a newline.