pcb-rnd knowledge pool
Producing gerber drill files
gerber_drill by Tibor 'Igor2' Palinkas on 2019-03-31
Tags: howto, gerber, drill, slot, outline, mech, plated, unplated, excellon, fab, cam
Abstract: Most often we send the "outline" layer in gerber but drills/slots in excellon to our fab. Long term the industry is likely to switch from excellon drill files to gerber. This article explains how to produce gerber drill files using the CAM syntax.
The programmer who originally wrote the gerber export code thought it was a good idea to make it export both gerber and excellon, and there is a lot of code branching making sure one object ends up only one either output. So no hole or slot in gerber because "they should go in excellon".
For many fabs excellon is for both drills and slots (but not outline!). So in the classic, no-cam setup we do export slots in excellon only, so we do not break backward compatibility for now. But with CAM, we are free to clean up the mess.
What's available with CAM
Since r24369, pcb-rnd can export gerber drill/slot files too, using the CAM syntax.
For keeping compatibility with the old, pre-CAM hackery, the new code is enabled only when you are using cam. With CAM, it is possible to export pdrill, udrill, proute, uroute purposed layer groups in any combination, using the gerber format or the excellon format.
Long term we will complete the excellon split and we will remove the hardwired gerber name styles. When that happens, there will be only one naming style, which will be verbose and will have files for drills/slots.
How to export gerber drill files with the cam syntax
The most common related layer group descriptions are:
|CAM group description||meaning|
|mech(purpose=uroute)||unplated, routed mechanical layer: unplated slots and unplated small internal cutouts; drilled holes not included; generated from padstack slots and objects (e.g. lines) drawn on the corresponding layer|
|mech(purpose=proute)||plated, routed mechanical layer: plated slots (and plated small internal cutouts); drilled holes not included; generated from padstack slots and objects (e.g. lines) drawn on the corresponding layer|
|virtual(purpose=udrill)||unplated drilled holes (always generated from padstacks, there is no other object that can make a drilled hole)|
|virtual(purpose=pdrill)||plated drilled holes (always generated from padstacks, there is no other object that can make a drilled hole)|
|boundary(purpose=uroute)||unplated, routed boundary of the board; typically outline, but we use the same layer for larger internal cutouts too; generated from explicit objects on the corresponding layer or if there is no boundary, auto-generated rectangle for board dimensions|
Note: a lot of other combinations are available, e.g. plated routed boundary, boundary with purpose set to vcut, etc.
Using this triangular the test board that has unplated featres on the left side and plated features on the right side, it is easy to try all cases. The following example shell script renders all the common combinations directly calling the gerber exporter with the --cam syntax.
Note: this will not produce any excellon drill file. The same lines with -x excellon instead of -x gerber would do excellon exports.