G-code Reader

A Python library to parse, interpret, and emulate G-code programs for CNC machines and 3D printers. Designed for engineers, researchers, analysts, and developers.

Key Features

  • Customizable G-code Flavors — Define and switch between G-code dialects.

  • Advanced Pre-processing — Resolve G-code parameters, variables, and calculations.

  • Versatile Output — Parse to Python objects or Pandas DataFrames. Export analysis files.

  • Process Emulation — Simulate machine state (position, feed rate) for analysis.

Supported Machines

Class

Alias

Description

CincinnatiBAAM

cincinnati, baam

Cincinnati BAAM large-scale additive manufacturing machine

CEADAMFlexbot

cead, flexbot

CEAD AM Flexbot 5-axis robotic additive manufacturing system

Hendrick

hendrick

Hendrick 5-axis CNC

Juggerbot

juggerbot

JuggerBot Tradesman

MasterPrint

ingersoll, masterprint

Ingersoll MasterPrint large-scale additive manufacturing system

ElectroImpact

electroimpact

ElectroImpact 5-axis advanced manufacturing robot configured for large-scale additive manufacturing

DesktopAM

desktop

Desktop AM machines with Marlin firmware

Quick Example

import gcode_reader as gr

# Simplest: parse to a DataFrame
df = gr.gcode_file_to_dataframe("my_part.gcode")
print(df[["x", "y", "z", "time"]].head())

# Full emulation: parse to an Operation object
operation = gr.gcode_to_operation("my_part.gcode", machine="cead")

Citation

If you use G-code Reader in your research, please cite:

@software{garfield_2025_17645205,
  author    = {Garfield, Nick and Helten, Britt},
  title     = {G-code Reader},
  month     = nov,
  year      = 2025,
  publisher = {University of Maine},
  version   = {1.0.0-beta},
  doi       = {10.5281/zenodo.17645205},
  url       = {https://doi.org/10.5281/zenodo.17645205},
}