Options: Drilling - pcb2gcode/pcb2gcode GitHub Wiki

Options: Drilling

pcb2gcode can convert an Excellon File Format drill file to gcode instructions for your CNC.

These are the options are are useful for drilling:

Drilling options, for making holes in the PCB:
  --drill arg                           Excellon drill file
  --milldrill [=arg(=1)] (=0)           [DEPRECATED] Use min-milldrill-hole-dia
                                        meter=0 instead
  --milldrill-diameter arg              diameter of the end mill used for 
                                        drilling with --milldrill
  --min-milldrill-hole-diameter arg (=inf)
                                        minimum hole width or milldrilling.  
                                        Holes smaller than this are drilled.  
                                        This implies milldrill
  --zdrill arg                          drilling depth
  --zmilldrill arg                      milldrilling depth
  --drill-feed arg                      drill feed in [i/m] or [mm/m]
  --drill-speed arg                     spindle rpm when drilling
  --drill-front [=arg(=1)]              [DEPRECATED, use drill-side instead] 
                                        drill through the front side of board
  --drill-side arg (=auto)              drill side; valid choices are front, 
                                        back or auto (default)
  --drills-available arg                list of drills available
  --onedrill [=arg(=1)] (=0)            use only one drill bit size
  --drill-output arg (=drill.ngc)       output file for drilling
  --nog91-1 [=arg(=1)] (=0)             do not explicitly set G91.1 in drill 
  --nog81 [=arg(=1)] (=0)               replace G81 with G0+G1
  --milldrill-output arg (=milldrill.ngc)
                                        output file for milldrilling

Drill vs Milldrill

There are two ways to make holes in your board:

  1. Use drill bits and drill straight through. This is called "drilling".
  2. Use milling bits and carve out the holes. This is called "milldrilling".

Drilling is the usual way and important for small holes which can otherwise not be milled because they are smaller than a milling bit diameter.

Milldrilling is more useful for large holes that are larger than the milling bit. Also, a single milling bit can do any size that is at least as big as the milling bit.

Milldrilling example photo

G85 slots (specification)

pcb2gcode supports G85 Excellon slots. To use this, you'll need a version of gerbv that supports it, at least 2.6a. If you don't have a version of gerbv that supports slots and try to use slots, warnings will appear when running pcb2gcode.

Drilled slots are made by drilling many successive holes. The number of holes is sufficient to meet that spec requirements of protrusions less than 0.0005 inches. Milldrilled holes are made by milling oval shapes deeper and deeper into the PCB.

Available drills

It's possible that your input has many drill sizes, some very similar. For example, you might have:

  • 0.498mm holes
  • 0.501mm holes
  • 1.000mm holes
  • 1.020mm holes

pcb2gcode will ask you to change drill bits after each tool change, even if the drill bit that you would use for 0.498 and 0.501 are probably the same drill bit! To solve this, you can specify available drills. For example, if you have a 0.5mm drill bit and a 1.0mm drill bit, you could write:


And holes near those sizes would get rounded to those specified sizes.

If you want, you can limit the rounding, too. For example:


Now only holes within 0.1mm of 0.5mm will be rounded to 0.5mm. And only holes within 0.01inches of 1mm will be rounded to 1mm. If you want to specify both the upper and lower bounds:


Holes between 53 thou and 65 thou will be drilled with the 60 thou bit.

Scenarios and sample configurations

These are snippets that you might put in your milldrill file.

Simple drilling of all holes

milldrill=false                 # Turned off to use drilling (default)
#milldrill-diameter=2mm         # Unused
#min-milldrill-hole-diameter    # Unused
zdrill=-1.6mm                   # PCB is 1.4mm but drill an extra 0.2 mm to make sure to go clean through
drill-feed=500mm/minute         # How fast to plunge the drill bit
drill-speed=10000rpm            # How fast to spin the drill bit
drill-side=auto                 # Let pcb2gcode choose which side to drill and report the results in the output
#drills-available               # Unused
onedrill=false                  # Use many different drill sizes (default)
#drill-output=drill.ngc         # Drilling output filename (default)
#milldrill-output=milldrill.ngc # Milldrilling output filename (default)

Milldrilling all holes

Same as drilling but change these:

milldrill=true                  # Turned on to use milldrilling
milldrill-diameter=2mm          # Milling bit is 2mm wide
#min-milldrill-hole-diameter    # Unused
zcut=-0.13inches                # Mill away 0.13 inches each pass

Drill just pilot holes

Same as drilling or milldrilling but use a much smaller depth to make a small indentation.

zdrill=-0.2mm                   # Just leave a mark for the drill press later
onedrill=true                   # All the pilot holes can use the same drill

Drill small holes and milldrill the big ones

Combine the milldrill and drilling configurations from above and add this:

min-milldrill-hole-diameter=2mm # Holes 2mm or above are milldrilled, the rest are drilled

Pilot holes for the drilling but full depth for milling

The default milldrill depth is the same as zdrill but you can override it with zmilldrill.

zdrill=-0.2mm                   # Just leave a mark for the drill press later
zmilldrill=-1.6mm               # milldrilling all the way through the PCB