Skip to main content

Python gcode parser

Project description

GcodeParser

A simple gcode parser that takes a string of text and returns a list where each gcode command is seperated into a python object.

The structure of the python object is:

G1 X10 Y-2.5 ; this is a comment

GcodeLine(
  command = ('G', 1),
  params = {'X': 10, 'Y': -2.5},
  comment = 'this is a comment',
)

Install

pip install gcodeparser

Alternatively:

pip install -e "git+https://github.com/AndyEveritt/GcodeParser.git@master#egg=gcodeparser"

Usage

from gcodeparser import GcodeParser

# open gcode file and store contents as variable
with open('my_gcode.gcode', 'r') as f:
  gcode = f.read()

GcodeParser(gcode).lines    # get parsed gcode lines

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gcodeparser-0.0.1.tar.gz (2.5 kB view hashes)

Uploaded Source

Built Distribution

gcodeparser-0.0.1-py3-none-any.whl (8.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page