Rust Gerber Library
This crate implements the basic building blocks of Gerber X2 (compatible with Gerber RS-274X) code. It focuses on the low-level types (to be used like an AST) and code generation and does not do any semantic checking.
For example, you can use an aperture without defining it. This will generate syntactically valid but semantically invalid Gerber code, but this module won't complain.
Current Gerber X2 spec: gerber-layer-format-specification-revision-2024-05_en.pdf
Example
You can find an example in the examples directory.
This library has a low-level focus and is quite verbose. Other external crates can provide a high-level API.
To generate Gerber code for that example:
$ cargo run --example polarities-apertures
Related crates
Gerber Parser
A rust crate for parsing gerber files that uses this crate as a dependency:
Crates.io: https://crates.io/crates/gerber-parser Github: https://github.com/MakerPnP/gerber-parser
Gerber Viewer
A rust crate for rendering gerber layers, also uses this crate as a dependency:
Github: https://github.com/MakerPnP/gerber-viewer
Related projects
For a list of other projects that use this crate you can check the github 'dependents' page.
https://github.com/MakerPnP/gerber-types/network/dependents
Authors
- Danilo Bargen - Original author.
- Dominic Clifton - Current maintainer (2025/05/05 onwards).
See the contributors page on github for full list.
License
Licensed under either of the following licenses, at your option.
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)