Understanding G90 GCode: The Absolute Positioning Command for CNC and 3D Printing

Understanding G90 GCode

G-code is the programming language used to control CNC machines and 3D printers. One of the most common g-code commands is G90, which sets the machine to use absolute positioning. This article provides an in-depth look at what G90 does, how to use it, and why it’s important for CNC and 3D printing.

What is G90 G-Code?

G90 is the g-code command that puts the machine into absolute positioning mode. This means that coordinate values are interpreted as absolute positions in the machine’s coordinate system, rather than relative moves from the current position.

Specifically, G90 does two key things:

  • Sets motion commands (X, Y, Z) to be interpreted as absolute positions
  • Sets coordinate values (used in G10, G28, G30, etc) to be absolute positions

So for example, G1 X10 Y15 Z5 would move the toolhead directly to the point X=10, Y=15, Z=5 in absolute machine coordinates. The starting position does not matter.

G90 is modal, meaning the machine will remain in absolute positioning mode until explicitly changed. The other positioning mode is incremental (G91), which interprets coordinates as relative offsets instead.

Why Use G90 G-Code?

Absolute positioning with G90 makes gcode programs much easier to understand and modify. Positions are always defined explicitly, without needing to know the starting position or do mental math to calculate movements.

This avoids the risk of losing position that can occur with incremental moves in G91. Just a small overlooked G91 move can offset the entire program. G90 avoids such issues by always moving directly to the specified coordinates.

The explicit nature of G90 also makes editing faster and less error-prone. Programmers don’t have to trace the entire program to calculate updated coordinates when changes are made.

Overall, G90 produces gcode that is:

  • Easier to visually parse and understand
  • More resilient to errors and loss of position
  • Simpler to modify without introducing new bugs

For these reasons, G90 is generally recommended over G91 for most applications. While G91 has uses for repeated patterns, G90 creates gcode that is clearer and more robust.

Default G90 vs G91 Setting

By default, CNC machines and 3D printers will power on in G90 absolute positioning mode. This prevents uncontrolled movement on startup since the machine must be explicitly commanded to move.

However, some g-code senders and CAM programs will reset to G91 incremental mode at the start of every newly sent file. So it’s good practice for gcode programs to include an explicit G90 line near the beginning.

This ensures the machine starts in absolute mode regardless of any leftover state from previous files. Simply including a G90 on the first or second line avoids any ambiguities.

G90 G-Code Format and Usage

Using G90 is very simple – it has no additional codes or parameters. The basic format is:

G90

To activate absolute positioning, just program this code by itself on a line anywhere in the gcode file.

For example:

G90 ;Sets absolute positioning mode G1 X10 Y15 ;Move to absolute X10 Y15 G1 X20 ;Move to absolute X20 (Y stays 15)

G90 is modal, so the machine will remain in absolute positioning until explicitly changed. This keeps things simple – no need to reprogram G90 before every absolute move.

To switch back to incremental mode, program:

G91

Why G90 is Important for CNC

Precise and unambiguous positioning is critical for CNC machining operations like milling, drilling, and turning. A small positioning error can easily ruin a workpiece.

So G90 is valued in CNC programs for:

Clarity: Absolute coordinates clearly specify the exact positions required for features, holes, etc. The programs are easy to visually parse and verify.

Robustness: G90 is robust against omissions or errors. A forgotten G91 incremental command won’t throw off positions.

Precision: Every coordinate moves straight to the programmed location, avoiding potential compounding errors.

For these reasons, nearly all CNC programs use G90 extensively, only using incremental G91 where necessary for repeating patterns. The reliability of G90 positioning is too important for CNC work.

Why G90 is Important for 3D Printing

3D printing also benefits from the explicit positioning of G90. While less critical than CNC, accuracy and reliability are still very desirable for 3D printing.

G90 helps 3D printing by:

Preventing Dripping: An accidental incremental move during travel could drag the nozzle over already printed areas, damaging the print. G90 avoids this by moving directly between coordinates.

Handling Power Loss: If power is lost and resumed, the print can continue properly as the absolute positions are still valid. G91 could offset everything.

Editing Gcode: G90’s absolute coordinates make it much easier to visualization prints and edit toolpaths if needed.

Custom Supports: Some slicers use incremental extrusion to generate support material. G90 ensures this doesn’t affect the model geometry.

So while G91 incremental has some uses in 3D printing, G90 absolute positioning is commonly used to ensure reliability.

Using Both G90 and G91

Using Both G90 and G91

G90 and G91 are not mutually exclusive. The two modes can be mixed within the same gcode program when appropriate. Some common examples are:

  • Use G90 for all printing moves, G91 only for retractions and wiping.
  • Use G90 for model geometry, G91 for generating support material.
  • Use G90 for most positioning, G91 only for repeated patterns.

This takes advantage of G90’s reliability for critical moves while still allowing G91 where the incremental control is needed.

The key is to always be very intentional about when each mode is enabled and why. Don’t blindly stick to only G90 or G91 – choose whichever makes the code clearest for each specific application.

G90 vs G92 Set Position

G92 is another g-code that sets position, but in a different way than G90. Understanding the difference is important:

G90 sets the mode to absolute positioning. All coordinates are then interpreted as positions in the machine coordinate system. The current position is unchanged.

G92 sets the current position to a specific coordinate, without changing the positioning mode. For example, G92 X10 would set the current X position to 10, while remaining in either G90 or G91 mode.

So G90 controls how coordinates are interpreted, while G92 sets the actual toolhead position. They work together to control positioning – G90 for destination coordinates, G92 for the starting position.

Absolute vs Machine Coordinates

One final point of confusion is the difference between “absolute coordinates” and “machine coordinates”. These two terms are not interchangeable:

  • Absolute coordinates refers specifically to the G90 positioning mode. Positions are absolute versus incremental.
  • Machine coordinates refer to the coordinate system of the CNC machine or printer. Typically X, Y, Z corresponding to axes of motion.

So absolute positioning with G90 moves the toolhead to absolute positions within the machine coordinate system. The coordinates are absolute, and the space is machine.

Conclusion

Understanding G90 is key to effectively programming and modifying gcode for CNC and 3D printing. The absolute positioning command clearly specifies coordinates, avoiding ambiguity and errors.

While incremental G91 positioning has uses in certain applications, G90 should generally be preferred wherever possible. The reliability and clarity of absolute positioning will produce better results.

Taking the time to properly learn G90 gcode will level up your abilities to program, troubleshoot, and optimize machining and printing workflows.

1 thought on “Understanding G90 GCode: The Absolute Positioning Command for CNC and 3D Printing”

  1. Pingback: Understanding GCode G90 and Absolute Positioning - 3DPrinterStuff

Comments are closed.