Skip to content

Path module GCode reference

Yorik van Havre edited this page Feb 15, 2015 · 5 revisions

In the FreeCAD Path module, path data is stored, inside Path objects as well as in inside saved .FcStd file, as a "minimal", or, "machine-agnostic" subset of GCode, for compactness reasons and also to offer a minimal effort to convert to/from machine-specific GCode dialects. The following rules and guidelines define this subset:

  • GCode data, inside FreeCAD Path objects, is separated into "Commands". A Command is defined by a command name, which must begin with G or M, and (optionally) arguments, which are in the form Letter = Float, for example X 0.02 or Y 3.5 or F 300. These are examples of typical GCode commands in FreeCAD:

    G0 X2.5 Y0 (The command name is G0, the arguments are X=2.5 and Y=0)

    G1 X30 (The command name is G1, the only argument is X=30)

    G90 (The command name is G90, there are no arguments)

  • For the numeric part of a G or M command, both "G1" or "G01" forms are supported.

  • Only commands starting with G or M are supported at the moment.

  • Only millimeters are accepted at the moment. G20/G21 are not considered.

  • Arguments are always sorted alphabetically. This means that if you create a command with "G1 X2 Y4 F300", it will be stored as "G1 F300 X2 Y4"

  • Arguments cannot be repeated inside a same command. For example, "G1 X1 Y2 X2 Y3" will not work. You will need to split it into two commands, for example: "G1 X1 Y2, G1 X2 Y3"

  • X, Y, Z, A, B, C arguments are absolute or relative, depending on the current G90/G91 mode. Default (if not specified) is absolute.

  • I, J, K are always relative to the last point. K can be omitted.

  • X, Y, or Z (and A, B, C) can be omitted. In this case, the previous X, Y or Z coordinates are maintained.

  • Gcode commands other than the ones listed in the table below are supported, that is, they are saved inside the path data (as long as they comply to the rules above, of course), but they simply won't produce any visible result on screen. For example, you could add a G81 command, it will be stored, but not displayed.

List of currently supported GCode commands:

Command Description Supported Arguments
G0 rapid move X,Y,Z,A,B,C
G1 normal move X,Y,Z,A,B,C
G2 clockwise arc X,Y,Z,A,B,C,I,J,K
G3 counterclockwise arc X,Y,Z,A,B,C,I,J,K
G81, G82, G83 drill X,Y,Z,R,Q
G90 absolute coordinates
G91 relative coordinates
(Message) comment
Clone this wiki locally