How to edit the incoming G code

Results 1 to 5 of 5

Thread: How to edit the incoming G code

  1. #1
    Registered
    Join Date
    Jan 2016
    Posts
    1
    Downloads
    0
    Uploads
    0

    Default 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!

    Similar Threads:


  2. #2
    Member CitizenOfDreams's Avatar
    Join Date
    Nov 2012
    Location
    USA
    Posts
    1267
    Downloads
    4
    Uploads
    0

    Default 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
    Member handlewanker's Avatar
    Join Date
    Sep 2006
    Location
    Australia
    Posts
    6463
    Downloads
    0
    Uploads
    0

    Default 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
    Member CitizenOfDreams's Avatar
    Join Date
    Nov 2012
    Location
    USA
    Posts
    1267
    Downloads
    4
    Uploads
    0

    Default 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
    Registered vegipete's Avatar
    Join Date
    Mar 2006
    Location
    Sol 3 (YVR)
    Posts
    202
    Downloads
    0
    Uploads
    0

    Default 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?



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
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

How to edit the incoming G code

How to edit the incoming G code