G-Code Resources

Resources for G-Code

G-Code is the language used to program/control automated fabrication tools, such as CNCs, 3D Printers, and even some Laser Cutters.

Good references:

Tips and Tricks

G28 Doesn’t think what you think it means

3D printers often use G28 to mean ‘home’ (and set reference point to 0,0,0.) This is non-standard; there is no ‘home’ command as part of G-Code. Instead the operator sets a reference point (via G28) which is the location of the tool.

The G28 reference point is set via G28.1. There is only one reference point for all work coordinate systems (G54, G55, etc.)

See this CNC Cookbook article

G28 and Fusion360 and GRBL Oddities

Fusion360 defaults to moving to the G28 reference point at the start of jobs. They assume that it’s set as a machine “safe spot”.

If a Fusion360 post starts by moving in a seemingly random/out-of-range location make sure you have set the G28 reference point!

For GRBL, G28 Z0 will cause a move ONLY in the Z axis.

Discussion and explanation of the above.

G54, G52, and G92 Work Offsets

CNC Cookbook article.

Setting G54 Work Coordinates using G10

CNC Cookbook article.

G-Code Senders

Nearly all of them interpret the GCode and may make changes to what is sent to the machine. E.g. UGS will remove M30; Carbide Motion interprets tool change commands (which include a T) and inserts commands to use the tool length measurement system.

G-Code Controllers

GRBL

Doesn’t support sub programs.
Removes M30 - due to resetting of work offsets (full explanation here)

Fusion360’s default post processor may have some issues.
Carbid3D has one (adds tool change commands for Nomad/Carbide Motion.)
Strooom post processor might be useful.

Nomad GRBL specifics

Carbide Motion has some built in magic to use the bit setter (tool length measurement) by injecting some G-Code for GRBL. This thread has some third party macros that do the same for UGS/CNCjs etc.

UCNC

Sub-programs

Example.

G-Code Utilities

G-Code Viewers/Simulators

A viewer will show you the G-Code and the paths defined. A simulator goes further and shows you what the final material will look like.

G-Code Generators

Translate from different data file types (e.g. images, scans, …) and convert to G-Code.

Includes libraries/tools that allow you to generate G-Code programmatically, e.g. with JavaScript, Python, Ruby, etc.

Some of these generate vector files (e.g. SVG, DXF), which can readily be converted to G-Code.