584,812 active members*
5,497 visitors online*
Register for free
Login
IndustryArena Forum > OpenSource CNC Design Center > Coding > How to edit the incoming G code
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2016
    Posts
    1

    How to edit the incoming G code

    Hi,

    This is my first thread and my first DIY router (for a college project).

    I'm using the Grbl and RepRap software controllers (not at the same time of course). I intend to modify the code of any of them.

    What I need to do is to understand how the program transforms alphanumerical data (g code) into pulses for the stepper drivers. This will give some extra value to my otherwise "copy+paste" project. I'd like to know where are the files I should rewrite.

    Is this too difficult to do? What else am I missing?

    Thanks in advance!

  2. #2
    Join Date
    Nov 2012
    Posts
    1267

    Re: How to edit the incoming G code

    The short answer is "interpolation". Each G-code command tells the tool to move from the current point to another point using a certain trajectory. This trajectory is interpolated - that is, broken into the stepper steps - using the following information:
    - The shape of the trajectory - straight line (G0, G1) or arc (G2, G3).
    - The feed speed commanded by the G-code.
    - The maximum acceleration/deceleration rate of the machine.
    - The speed and direction of the next moves (G-code lookahead).
    - And much, much more.

    In other words, yes, this is difficult and not the right place to start with DIY CNC.

  3. #3
    Join Date
    Sep 2006
    Posts
    6463

    Re: How to edit the incoming G code

    Hi....I didn't quite understand what you meant, but with my limited knowledge of G code programming......you have a G code program that is compiled from a CAD drawing that gets converted to G code by the CAM software............or you hand write it yourself........this is saved on a flash drive and gets loaded to the computer (attached to the CNC machine) via the USB port.

    When you hit the "load G code" box in the Mach 3 program you see the code listed in a window.......there is also a function that says "edit G code" in that window too.

    If you have the G code on a flash drive you can also open the G code listing file on your computer in Notepad and do an edit for whatever you want........then saving it to the same flash drive as ANOTHER DIFFERENT G code listing with a different name, so that the original is kept for reference and further development ....whatever.

    My opinion is....it's better to edit the G code on a separate computer and save it to a flash drive or whatever, and then load it to the CNC machine's computer via USB........the CNC machine's computer should not have anything on it apart from the operating system and Mach 3 ......AND DEFINATELY NOT ONLINE OR CONNECTED TO THE INTERNET.
    Ian.

  4. #4
    Join Date
    Nov 2012
    Posts
    1267

    Re: How to edit the incoming G code

    I believe the original poster did not mean editing the G-code, he meant changing the algorithm that converts G-code into the actual axis movements. Which is a hugely complex issue and definitely not the place for a CNC amateur to start.

  5. #5
    Join Date
    Mar 2006
    Posts
    202

    Re: How to edit the incoming G code

    Indeed, tearing into something like GRBL is no where near trivial. I expect there are many thousands of hours of development time in it with very intricate knowledge of the AVR processor it is running on.

    The source code on GITHUB is pretty nicely laid out to see how the bits work. GCODE.C handles parsing the actual received text. PLANNER.C works to link moves together. STEPPER.C has code for generating the actual pulses.

    What value do you think you can add?

Similar Threads

  1. CODE AT CIMCO EDIT V5 ,
    By dmfc in forum Fanuc
    Replies: 4
    Last Post: 06-29-2013, 04:21 AM
  2. Notepad++ G CODE EDIT ANY ONE?
    By VoKuS in forum Coding
    Replies: 8
    Last Post: 10-23-2012, 03:34 AM
  3. Edit G- code cant get file???
    By Spencer myers in forum SolidCAM for SolidWorks and SolidCAM for Inventor
    Replies: 3
    Last Post: 05-20-2012, 11:45 PM
  4. Edit Code for final move
    By millman52 in forum Mach Plasma / Laser
    Replies: 6
    Last Post: 05-05-2010, 11:40 PM
  5. Edit>Copy to Clipboard>Error: Guarded Code
    By DEAN in forum Haas Mills
    Replies: 3
    Last Post: 02-01-2007, 09:28 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •