GithubHelp home page GithubHelp logo

gpr's Introduction

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.

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!

gpr's People

Contributors

built1n avatar code-beans avatar dillonhuff avatar tweakoz avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.