- Notifications
You must be signed in to change notification settings - Fork5
Simple gerber parser meant to be used in conjuction with the gerber-types crate
License
Apache-2.0, MIT licenses found
Licenses found
MakerPnP/gerber-parser
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This crate implements agerber
parser written in rust to be used with thegerber-types
crate.
See theexamples
folder of the repository, run it as follows:
$ cargo run --example example1
The gerber specification 2024.05 is the latest version of the Gerber file format that is used for reference.
Supported | Feature | Notes |
---|---|---|
✅ | Comments (G04) | |
✅ | Units (MO) | |
✅ | Format specification (FS) | |
✅ | Aperture definition (AD) | |
✅ | Standard aperture templates | |
✅ | Aperture macros (AM) | |
✅ | Select aperture (Dnn) | |
✅ | Plot state (G01, G02, G03, G75) | |
✅ | Operations (D01, D02, D03) | |
✅ | Transformations (LP, LM, LR, LS) | |
✅ | Regions (G36/G37) | |
✅ | Block aperture (AB) | |
✅ | Step repeat (SR) | |
✅ | End-of-file (M02) | |
✅ | File attributes (TF) | |
✅ | Aperture attributes (TA) | |
✅ | Object attributes (TO) | |
✅ | Delete attribute (TD) | |
✅ | Standard attributes | Full support, including .N, .P, .C, .CXxxx, etc |
✅ | User defined attributes | |
✅ | Comment attributes | See spec 2024.5 - 5.1.1, 'G04 #@! ...* |
✅ | Image Transformations (IP, MI, SF, OF, IR, AS) | Yes, see below for details |
✅ | Legacy/deprecated attributes | Partial |
Contributions to improve support welcomed!
Image transformations have been deprecated since December 2012 (I1 revision).The intention of these commands is not entirely clear when it comes to rendering, since the spec talks aboutstep and repeat distances not being coordinate data; However, it doesn't make any sense to have a command calledMirror Image (MI) where the intention /appears/ to be to mirror the /entire/ image, which cannot be achieved unless youalso mirror step and repeat distances and apertures. Thus it is advised for downstream crates to apply imagetransformations to step and repeat distances and apertures when applying image transformations via (MI, SF, OF, IR).
The related crate 'gerber-viewer' (see below), creates an image transform matrix based on the image transformationcommands and applies them before rendering, but after primitive processing, resulting in a perfectly transformed imagewhich is always consistent. However, depending on the intention of the author of the gerber file and the tools they wereusing at the time that might not be "correct". Thus, as per the spec, it's best to avoid these commands entirely toavoid misinterpretation and/or manufacturing issues.
Refer to gerber spec 2024.05 sections 8.1.5 (IR), 8.1.7 (MI), 8.1.8 (OF), 8.1.9 (SF)
A rust crate for definition of gerber types in test.
Crates.io:https://crates.io/crates/gerber-typesGithub:https://github.com/MakerPnP/gerber-types
A rust crate for rendering gerber layers, also uses this crate as a dependency:
Github:https://github.com/MakerPnP/gerber-viewer
For a list of other projects that use this crate you can check the github 'dependents' page.
https://github.com/MakerPnP/gerber-parser/network/dependents
- 2022/06/27 - Initial version by Nemo Adrea, licensed on AGPL.The original author used f360, the initial implementation was written to support files it generated.
- 2024/04/23 - Crate went under heavy development to broaden the support for Gerber files, e.g. ones generated by KiCad, DipTrace,LibrePcb, etc.
- 2025/05/05 - gerber-types crate transferred to the MakerPnP organization, primary maintainer is now Dominic Clifton
- 2025/06/04 - gerber-parser crate transferred the repository to the MakerPnP organization, primary maintainer is now Dominic Clifton.
- 2025/06/13 - All non-deprecated gerber commands are now supported. License changed to MIT or APACHE.
- 2025/07/11 - Support for deprecated commands added.
- Nemo Andrea (Original author)
- Dominic Clifton (Current maintainer)
Available under APACHEor MIT licenses, the same as the gerber-types crate.
About
Simple gerber parser meant to be used in conjuction with the gerber-types crate
Topics
Resources
License
Apache-2.0, MIT licenses found
Licenses found
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.