Welcome to Our Community

Some features disabled for guests. Register Today.

Skip Through G-Code

Discussion in 'Control Software' started by trent109, Feb 8, 2020.

  1. trent109

    trent109 New
    Builder

    Joined:
    Mar 20, 2018
    Messages:
    2
    Likes Received:
    0
    In the openbuild control software. Is there a way to jump around the G-code a little bit? I had a piece of wood that was a little thinner is a spot and I just wanted to move the Z in a bit and re-run that section of code... I click on the code I want it to run and it just starts back up at the top...

    Thanks
     
  2. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,681
    Likes Received:
    1,321
    You could edit the g-code file, but you need to be aware that there is a fair bit of code at the beginning of a file that sets up some crucial bits, like what units are in use, where to start cutting etc. There can also be bits of code in the middle that make sure you retract Z to a safe height before moving that can be overlooked if you start somewhere in the middle.
    Depending on the nature of the job you might be able to lower Z, reset workplace zero and run the whole job again.
    For future jobs get in the habit of checking material thickness (it's often different from the "nominal" size) and surface it if you think it might be uneven.
    Alex.
     
    trent109 likes this.
  3. trent109

    trent109 New
    Builder

    Joined:
    Mar 20, 2018
    Messages:
    2
    Likes Received:
    0
    Thanks for the response!! I figured that was the only option with editing the gcode file but thought I'd ask. Im not an "expert" at GCode but I have a bit of experience.

    I just got my machine together and got in a bit of a hurry checking my thickness!

    Again Thanks for the response
    Trent
     
  4. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,681
    Likes Received:
    1,321
    Yes, the reason no control software I'm aware of has an easy option to run part of a file is because it is generally a really bad idea. It is really easy to overlook and leave out something crucial. It is not something I'd be inclined to do.
    Alex.
     
    Peter Van Der Walt likes this.
  5. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    1,470
    Likes Received:
    746
    Mitsu control- the underlying software of Citizen swiss lathes and apparently Mazaks- actually has a forward-and-reverse block mode using the jog wheel. It's not super common though. Haas has a forward-only version currently in early testing, I think. I don't believe Fanuc has anything like it though, that I've heard of anyway.

    In theory, there's no reason why you couldn't do this in G90 absolute mode, I would think that's part of the reason g-code is typically programmed in absolute coordinates, for convenient block running. But, what I'd probably do instead would be to duplicate the file, keep the header, replace the first part of the program with a rapid to the start of that block (or just above the surface near the start), then replace the rest of the program before the M2 with a rapid back up to a safe area. So you have a "spring pass" program (if you don't change your G54 z-zero) or a "skim pass" program (if you knock G54 z-zero down by say, half a mm or whatever).

    This is, however, where precise probing and accurate palletization/fixturing comes into play. You don't want to adjust your coordinates only to find that your workpiece is out of position as well.
     
  6. Gary Caruso

    Gary Caruso OpenBuilds Volunteer
    Staff Member Moderator Builder

    Joined:
    May 19, 2016
    Messages:
    1,184
    Likes Received:
    531
    With ESTLcam you can click on any line and start from there, the visualizer updates after clicking so you can see where the tool will go. Came in handy on a long cut I did with very delicate 1mm burr bits that kept breaking on me, had to restart 5 times:confused:
    Gary
     
  7. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    1,470
    Likes Received:
    746
    That's pretty cool. I've tried to run block mode in bCNC, but I think it's fought me every time. I should try again, because block mode and arbitrary run-from-line are really super important in prototype work.
     
    Gary Caruso likes this.
  8. phil from seattle

    phil from seattle Journeyman
    Builder

    Joined:
    Mar 17, 2017
    Messages:
    312
    Likes Received:
    137
    Maybe this is too obvious to need saying but in the case where you have an uneven work piece, it is a good idea to surface it to a uniform thickness. Then you don't have the problem you are trying to solve.

    I believe that some motion controllers are capable of handing a non-uniform surface though GRBL ain't in that category. Maybe the 32bit version will get there.
     
    Peter Van Der Walt likes this.
  9. dws4wdr

    dws4wdr New
    Builder

    Joined:
    Mar 13, 2019
    Messages:
    2
    Likes Received:
    1
    I also have been looking for a way to jump to a specific gcode line. I had a a vector that no matter what I did it wanted to cut a hole through the entire thickness of my design. This was created in VCarve desktop. The code was a plain star.All I wanted was an outline of the star. yes I'm a nube,... When it started cutting I realized it was cutting completely through the material. I had 2 stars. so I wanted to stop the 1st and move to the second. I never found a way to do this.

    David
     
  10. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    13,751
    Likes Received:
    4,070
    Best to Re-CAM the job to do exactly what you want to do, then rerun the updated file.
    In CAM you can more easily exclude the first star for example, only toolpath the second, and run it
     
    Quentin Karmark likes this.
  11. Quentin Karmark

    Builder

    Joined:
    Apr 29, 2021
    Messages:
    27
    Likes Received:
    15
    Could we re-visit this post? It seems you can manually skip (go to) a certain section or operation using GOTO and I found the line ( #51010 ) where I need to jump to but I don’t know how to tell the command to do that?

    i tried GOTO51010 but get an error.
     
  12. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    1,470
    Likes Received:
    746
    grbl doesn't have a program flow or logic interpreter because it's drip-fed, all it knows is the ~8-15 lines it currently holds in the buffer/planner. So you're stuck doing it within the sender. Pretty sure bCNC will interpret Python within the program, I seem to recall such a thing. Not sure if CONTROL can interpret, say, Javascript, though I'd be inclined to suspect not.

    GOTO is really not a good command in any language though, you're better off using subroutines with logic switching, but I don't think you can do that kind of thing with grbl, that's more the domain of "proper" control software like LinuxCNC. I have an example on the forum of a flow-controlled subroutine-based g-code program I wrote a while back:

    Other than these few examples, what controls interpret what codes is a properietary thing up to the vendor- Fanuc interprets differently than Siemens interprets differently than Heidenhain... G-code isn't standardized once you get outside of the basics.
     
    Alex Chambers likes this.
  13. phil from seattle

    phil from seattle Journeyman
    Builder

    Joined:
    Mar 17, 2017
    Messages:
    312
    Likes Received:
    137
    Probably the simplest way to do this is just edit the gcode and delete the first star section. What you want is canned cycles that allow you to repeat a section of gcode at a specific location. Unfortunately, most Grbls (including all 8-bit ones) do not support that.

    I will often break a job into sections, zero the machine where I want the cutting done and run it. reposition, repeat for each one. I'm doing that with a set of dog holes for the spoil board of my new Avid pro4848 that I am finishing up on.

    [edit] and while I'm on it, GCode barely qualifies as a programming language. I would love to see a simple subroutine mechanism. Canned cycles sort of is one but is kind of obscure and lacks even the simplest modern programming language concepts.
     
    #13 phil from seattle, Jul 31, 2021
    Last edited: Jul 31, 2021
  14. Quentin Karmark

    Builder

    Joined:
    Apr 29, 2021
    Messages:
    27
    Likes Received:
    15
    thanks for everyone's responses. yes I understand now that I would have to manually edit the Gcode or re-post it somehow. I wondered if macros were meant to do something like that but perhaps not.
     
  15. Torin3

    Torin3 Well-Known
    Builder

    Joined:
    Apr 18, 2021
    Messages:
    85
    Likes Received:
    37
    Just FYI, the more recent Haas and Brother mills I use at work have a restart from arbitrary line option. They both appear to handle it by running through the program from the start and soft loading and unloading G & M codes until it reaches the line you want to start from, then hard loads what should be the proper G & M codes and continues on. Haas visually runs through the program so you can see what that is doing. The Brother machines physically load the previous tool, then load the current tool, start the tool and then move it to where it should be for the start of the line you want to run from. Policy at work is to only start it where you are doing a tool change, as we consider it potentially risky to jump to into a toolpath in the middle.
     
  16. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,238
    Likes Received:
    1,815
    As i have mentioned before, and someone did mention it above, bCNC has a handy block 'hide' in the editor.
    You don't have to use bCNC for your controller, you can use it just as an editor for this job. Load your Gcode, deselect the blocks you don't want, save Gcode.
    Load that Gcode into OBControl and cut away.
    Never hide the first and last block! they do the housekeeping that is essential to success.

    However, you do want to learn to read Gcode, it is really beneficial in the long run, and makes stuff like this much easier.
     

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