Welcome to Our Community

Some features disabled for guests. Register Today.

G-Code Sender with Loops for GRBL

Discussion in 'Control Software' started by JSPiDE, Jan 12, 2021.

  1. JSPiDE

    JSPiDE New
    Builder

    Joined:
    Jan 12, 2021
    Messages:
    2
    Likes Received:
    1
    Hello Community,

    I have a self build CNC-Machine which is using GRBL 1.1 as G-Code interpreter.
    GRBL can´t working with loops terms and conditions, thats established. I also know that the G-Code spezification doesn´t support this, too.

    But for my application is it neccessary to work with loops in G-Code.
    Now I want to know if there is any G-Code streamer out there which is compatible with GRBL and allows the usage of loops, terms and conditions (for example: modified G-Code-streamer with parser for loops).

    I hope that somebody can help.

    Best regards
    JSPiDE
     
  2. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,239
    Likes Received:
    1,815
    Well, it sort of does support it, MacroB is one specification, and LinuxCNC has elements of it for implementing loops and subroutines.

    I don't know of a current one, but bCNC comes close and maybe a bit of encouragement to the writers will see it happen.
    Macro Reserved Words for bCNC · Issue #60 · vlachoudis/bCNC
    vlachoudis/bCNC
    Traverse around bounding box option · Issue #38 · vlachoudis/bCNC

    You can always write your own, start with a basic streamer and add your own macro commands to the Gcode (follow what LinuxCNC does!) and put code in the streamer to process the commands that are not standard Gcode.
    gnea/grbl look at 'simple-stream.py'

    What I would do is write a program (probably php, but could be Python/Perl/C/Java/whatever) to output my 'looped' Gcode to a file, creating 1000 or 5000 or whatever many blocks of code as needed (how many hours does it need to run?).
    Then any GUI can run the code.
     
  3. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    1,470
    Likes Received:
    746
    The general spec may be limited (I haven't checked) but most implementations allow for it; Fanuc has a lot of control over code flow, as will most of the other major controllers- Siemens, Heidenhain, etc. Modern manufacturing techniques require conditional programming and inline value changes from probing, tool life management, you name it.

    I did it myself on a LinuxCNC machine here:

    This is very interesting. I also didn't know that bCNC could parse and run inline Python?! Could be very useful, I'll have to look more into that. I guess I've never properly read the bCNC wiki, gonna have to rectify that.
     
    David the swarfer likes this.
  4. JSPiDE

    JSPiDE New
    Builder

    Joined:
    Jan 12, 2021
    Messages:
    2
    Likes Received:
    1
    Hi,

    thanks for your replies.
    I´ve seen bCNC, too. But for my application i have found a very easy way to send g-code in a loop.
    The GRBL-project brings two python-scripts with it.
    These scripts are for gcode streaming. Modify them with a simple while-loop and a exit statement should do the job.

    I also looked for some other solutions. Every solution which is using loops, is a specific manufacturer version. The basic gcode specification is from 1983/1988 (DIN 66025-1/2) and doesn´t support something like that. This specification only supports subfunctions.

    Thanks to everyone of you who replied.

    JSPiDE
     
    David the swarfer likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice