APIs, concepts, guides, and more
|
Use G-Code to specify coordinated motions in Cartesian space for specialized machines, with support for basic codes and a user interface for building or using pre-built configurations.
G-Code is a programming language for specifying coordinated motions in cartesian space used by many manufacturing machines.
In the RapidCode API, G-Code parsing requires the creation of a Robot instance, which requires the kinematic model to be specified, and a MultiAxis instance that contains all of the axes used during the execution of the G-Code file. Machines with linear prime or redundant axes can also be configured by specifying the axis to link their motion to using LinearModelBuilder.
You can find the full set of G-Code functions in our Gcode class.
Build your user interface using our Gcode class or use our G-Code UI built into RapidSetup.
Code | Description | Explanation |
---|---|---|
G0 | Rapid positioning | Rapid motion to a point in Cartesian space via the quickest path (not always linear), using default axis settings (DefaultVelocitySet) |
G1 | Linear interpolation | Coordinated linear motion between points in cartesian space |
G2 | Circular interpolation, clockwise | Clockwise arc motion about a center point to an end point |
G3 | Circular interpolation, counter clockwise | Counter clockwise arc motion about a center point to an end point |
G4 | Dwell | Pauses all axes for the specified time in seconds, which may be fractional. |
G9 | Exact stop check (non-modal) | Placed before a motion group command, the machine will come to a complete stop at end of the move before continuing to the next. Only remains active for one line. |
G17 | XY plane selection | G2/3 commands happen on the XY plane (Default mode) |
G18 | ZX plane selection | G2/3 commands happen on the ZX plane |
G19 | YZ plane selection | G2/3 commands happen on the YZ plane |
G20 | Programming in inches (in) | Distances after this command will be interpreted as inches. Rotations are always in degrees |
G21 | Programming in millimeters (mm) | Distances after this command will be interpreted as mm. Rotations are always in degrees |
G54 -G59 | Work Offset | Applies a pre-configured XYZ offset relative to home(origin) to all motions. |
G61 | Exact Stop Check (modal) | The machine will come to a complete stop at end of the move before continuing to the next for all future moves until G64 is called. |
G64 | Cancel Exact Stop | Reset to default cutting mode (cancel G61) |
G90 | Absolute programming | Distances after this command will be interpreted as absolute (relative to origin 0,0,0) |
G91 | Incremental programming (relative) | Distances after this command will be interpreted as incremental (relative to current position at start of move) |
G92 | Coordinate System Offset | Sets the current (absolute) position to have the specified coordinate values by moving the origin. |
Currently, all M-codes are supported by calling a user-defined callback, as specified in GcodeCallback.
When running a G-Code file (Gcode.Run), when the M-code is encountered, it completes the motion preceding it, executes the callback, and then continues the motion in the remainder of the file.
Helical G2/3
motions
Features not listed above
Setup and run a simple G-Code program.
How changing linear units affects vel and accel setters.