Coder Social home page Coder Social logo

michaelnessy2143 / gcodecleaner Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 5 KB

This code takes all the unnecessary data out of the g-code leaving only the X,Y,Z,E values. This is for the purpose of taking the output from a slicer like Cura or PrusaSlicer and passing the output to a 6-axis 3D printer.

License: MIT License

Python 100.00%

gcodecleaner's Introduction

GCodeCleaner

This code takes all the unnecessary data out of the g-code leaving only the X,Y,Z,E values. This is for the purpose of taking the output from a slicer like Cura or PrusaSlicer and passing the output to a 6-axis 3D printer.

Description: This script removes comments from a G-code file and extracts the X, Y, Z, and E values from each line. It produces a cleaned output file with the extracted values.

Usage:

  1. Run the script and provide the path to the input G-code file.
  2. Enter the path to save the cleaned output file.  Make sure that the paths provided are not surronded by "quotes"
  3. The script will remove comments and extract X, Y, Z, and E values from the input file.
  4. The cleaned output file will be saved in the specified path.

Functions:

  1. remove_comments(gcode_file, output_file):
    • Removes comments from the input G-code file and extracts X, Y, Z, and E values.
    • Parameters:
      • gcode_file (str): Path to the input G-code file.
      • output_file (str): Path to save the cleaned output file.
    • Returns: None

Example Usage:

  1. Input: Enter the path to the input G-code file: /path/to/input.gcode Enter the path to save the cleaned output: /path/to/output.txt Output: X, Y, Z, E values extracted from '/path/to/input.gcode'. Cleaned output saved to '/path/to/output.txt'.

Note:

  • The script assumes that the G-code file is in a readable format.
  • The output file will contain extracted X, Y, Z, and E values in the same format as the input file, with each line representing a set of values.
  • The script uses regular expressions to remove comments and extract the desired values.
  • Make sure to have the necessary permissions to read the input file and write to the output file.

gcodecleaner's People

Contributors

michaelnessy2143 avatar

Stargazers

 avatar

Watchers

 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.