Command-line tool for engraving pcbs using cncs
pcb2gcode [options]
This manual page documents briefly the pcb2gcode command.
pcb2gcode is a program that takes the files typically produced by PCB (printed circuit board) designing tools, in particular Gerber (RS-274X) and Excellon (an RS-274C variant) files as parsed by gerbv, and produces files that can be used to control a CNC (computer numerical control) milling machine. These files are in G code format (RS-274D/NGC) that can be read, for example, by the linuxcnc EMC2 system.
When these files are executed, an engraving bit is used to remove the surface from a copper covered circuit board, thus creating isolated areas. In another step, holes are drilled into the board at the appropriate positions, and it can be cut out in another step. (For each step, a separate output file is created.)
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below.
Instead of passing all options on the command line, nearly all options can be stored in a file named millproject. There, options are given one per line as option=value pairs (without the two dashes), and can be separated by blank lines and commented (everything after a `#` character is treated as a comment). Options that don't take an argument (like --metric) are entered as option=1 there.
Unless configured otherwise, numeric values are in units of inch and inch/minute. When the --metric option is given, they are in mm and mm/minute.
--front filename.gbr
Engrave the front side according to the given file (typically used in two-sided boards).
--back filename.gbr
Engrave the back side according to the given file.
--outline filename.gbr
Cut out the board to the shape exposed in the given file. Typically, there is only a polygon in this gerber file. Alternatively, this file can contain a closed line chain (see --fill-outline).
--drill filename.cnc
Convert the given file (containing drill sizes and positions) to G-code.
For every option --x that takes a filename, there is an --x-output option that specifies where the resulting G-code is saved, defaulting to x.gbr. Instead of giving each output file name, the --basename option can be used; the base name will be used as a prefix to the default output file names.
The parameters that define engraving are:
--zwork unit
Z-coordinate at which engraving happens
--zsafe unit
Z-coordinate for movements between engraving steps
--mill-feed unit/minute
feed rate at which engraving takes place (horizontal speed)
--mill-speed rpm
spindle speed during engraving (rounds per minute)
--offset unit
distance by which the tool movement will be outset from the contours in the gerber file to be engraved
If this distance can't be satisfied because copper areas are too close, a warning will be printed and the line will be drawn between the areas. This behavior can be used to get voronoi-style (flood-filling) areas; simply set the offset to a large value (like 1 inch).
--extra-passes number
number of additional isolation passes
For each extra pass, engraving is repeated with the offset width increased by half its original value, creating wider isolation areas.
The parameters that define outline cutting are:
--cutter-diameter unit
amount by half of which the tool path is outset from the shape in the outline file
--zcut unit
Z-coordinate indicating where the outline cutting ends
--cut-feed unit/minute
feed rate at which outline cutting takes place (horizontal speed)
--cut-speed rpm
spindle speed during outline cutting (rounds per minute)
--cut-infeed unit
maximum Z distance that is cut away in a single pass (positive value; if less then zcut's value, there will be more than one pass)
--fill-outline
If --fill-outline is given, it is assumed that the outline file contains not a polygon but a closed chain of lines. The board will be cut along the centres of these lines.
--outline-width unit
thickness of the lines that form the outline (if --fill-outline is given)
Drilling takes another set of options:
--zdrill unit
Z value down to which will be drilled
--zchange unit
Z-coordinate for movements with the drill head
--drill-feed unit/minute
feed rate for drilling (vertical speed)
--drill-speed rpm
spindle speed during drilling (rounds per minute)
--milldrill
If --milldrill is given, the milling head will be used to drill the holes in the PCB. Holes up to the size of the milling head will be drilled regularly (possibly creating a bigger hole than intended), the other holes are created by moving the head in circles using the feed and infeed parameters used in cutting.
--drill-front
use the coordinates of the front side for drilling instead of the coordinates of the back side
These options govern the general behavior of pcb2gcode:
--dpi dpi
resolution used internally (defaults to 1000)
--mirror-absolute
mirror operations on the back side along the Y axis instead of the board center, which is the default
--svg filename
export the resulting contours to an SVG (scalable vector graphics) file
The only options that can't be used in the millproject file are the common ones:
-?, --help
Show summary of options.
-v, --version
Show version of program.
pcb2gcode was written by Patrick Birnzain, loosely based on an earlier program of the same name by Jeff Prothero (Cynbe ru Taren), which in term was based even more loosely on Matthew Sager's gerber_to_gcode.
This manual page was written by chrysn <[email protected]> for the Debian project (and may be used by others).