GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - dillonhuff/gpr: A simple C++ G-code parser

BranchesTags
Open more actions menu

Latest commit

 

History

114 Commits
114 Commits

Folders and files

NameName
Last commit message
Last commit date
gcode_samples
gcode_samples
 
 
src
src
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
CMakeLists.txt
CMakeLists.txt
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

Synopsis

GPR is a small, MIT license, C++11 G-code parser. It is intended to provide the lowest level of parsing for G-code, breaking up raw G-code text into blocks consisting of comments and word-address style commands.

What is G-code?

G-code is the universal language of machine tools. It is used to control everything from mills and lathes to EDM machines and 3D printers.

Though the syntax and semantics of g-code are officially defined by ISO 6983 it is not really a single language. Different machine vendors implement different subsets of the standard and different non-standard extensions for their own equipment.

What everybody agrees on is that G-code programs consist of blocks, which are really just lines of text. Each block consists of:

  1. An optional block delete character '/'
  2. An optional line number
  3. Any number of words, parameter settings and comments
  4. An end of line marker (carriage return)

G-code emitted by modern CAM systems usually consists mostly of comments and words. For example the G-code program below has 4 blocks: 1 comment, and three movement commands.


(*** Toolpath 1 ***)
G0 X0.0 Y0.0 Z0.0
G1 X1.0 F23.0
G1 Z-1.0 F10.0

Since the interpretation of G-code commands varies from vendor to vendor this parser does not make any attempt to interpret G-code commands. It simply parses G-code and returns the parsed blocks.

G-code Dialects Supported

This parser has been tested on 5 different G-code samples which are in the gcode_samples folder

  1. RepRap: A common G-code dialect used by 3D printers like the monoprice select mini, the sample was produced by Cura.
  2. LinuxCNC: The sample in the github repo was produced for a 3 axis mill by an experimental CAM system from Stanford.
  3. Vectric: Generated by VCarve Pro for a CAMASTER router
  4. HAAS: Taken from a machinists forum post.
  5. Mazak: Produced by Mazak's Mazatrol to G-code converter.

Build Instructions

cmake .
make -j
./all-tests

Feedback

If you use this parser in your own project I would really like to hear from you about it. Let me know what you liked and what could be better, and if you like this parser please give the repo a star!

About

A simple C++ G-code parser

Resources

Readme
MIT license
Activity

Stars

98 stars

Watchers

8 watching

Forks

40 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.