Restart gcode mid way?

I’m not seeing anyway to Goto a line in a gcode file in UGS. Is there a way to start a gcode file at a line number? I’ve had a few occasions where I notice a misstep during a cut, however the only way I know to correct is to stop the process and restart from the beginning.

Hence why I’m asking if anyone knows how you can load a gcode file and goto a line. I’m assuming I can restart at the latest line sent to the CNC.

Another option would be to modify the Gcode file, by removing the lines which have already been sent to the CNC. I’ve attempted to do this without any luck. Where can one find information on modifying gcode files?

The problem with most Gcode files is that on line X they’ll just set the Z depth then the other lines will only be an X and/or Y command(s). Each line is not guaranteed to have an X, Y, and Z command. So you’d need to find the last Z motion command before the X and Y commands.

It’d be complicated to do but probably not worth it.

what would said tool be worth to you?

1 Like

@JustinBusby Yes, I’ve noticed in the gcode lack of Z depth. It only includes it when it changes. I’ve not figured out how to reduce a file based on z yet. That is the key I see that.

@JeremySimmons Well that depends on the mistake I’ve just made… I presume your talking about a tool that replaces UGS? Or one that trims gcode files, which would be very handy and cool. I’d be willing to trade $ for such a tool.

Note: I’m a wood butcher trying to be a semi-professional when day when I grow up.

1 Like

Yes. Either a tool that replaces UGS completely, or a utility that would help one create a ‘resume-at-point’ for a G-Code file.

How much do you think such a program would be worth?

Estlcam will do this. It’s a bit fidgety finding your point to start from but it gets the job done.

@JeremySimmons well Estlcam is $59, that’s most likely a bit high for a gcode file utility, which I think would be the best option unless one felt really ambitious to replace UGS completely. After many years in tech, I’m falling into ‘eee it works’ not need to reinvent the world. But don’t let me stop you, a program can be made better than UGS.

The CAM aspect is free.

EDIT: just got the meaning of your post Greg. Sorry for the slow uptake. But I think the free aspect of Estlcam would do this. Not to discourage Jeremy from coming up with something that stands alone!

it would take a long time to calculate the WCS position after each command was executed…
yes, notepad is free, and that’s great for splitting a file, but you need to find the X,Y,Z in WCS that command should start at…

@JeremySimmons is right, figuring out the place to split the file is the trick. I tried and my rotor went on an angle that’s not in my toolpath.

This can be easily done In bCNC. You can visualize your gcode by selecting lines/blocks, edit your code (e.g. if you need to add an extra Z move) and execute lines/blocks of code selectively.

Free, open source and with a growing github community.

@EliasPolitis Whoa nice, thank you for the info. Looks really interesting and sounds promising, I’ll play with it tonight

@EliasPolitis Okay, I assume you have bCNC installed. What’s the trick to running it? I’ve downloaded the zip and expanded. Installed the latest Python. How to you run the bCNC app? The bCNC pages simply say ‘run the bCNC command’. I must be dense (I know that already), how does one run the bCNC command? From Python? From command? Any help would be greatly appreciated.

@JeremySimmons Okay my frustration level is rising, I’m willing to pay more for a g-code editor… Any programming in your future?

I just had another CNC project fail due to missteps. I’ve ordered a X-Controller. Much as I’d love to build one, I simply don’t have the time right now, so I went with premade. I’m guessing my electronics are over heating. The mechanics looked simple on this one. I really need a way to replay the 5mins before the misstep happen without a complete restart hours ago.

I got seriously frustrated with the User Interface in bCNC when I tried it months ago. It was a non-starter for me.

That said, I did have next to zero issues getting it to run (I’m a software dev by trade, so none of the instructions or installation of python reads as the equivalent ancient sanskrit to me)

windows instructions for bCNC

the file you’re looking for is bCNC.bat.

it assumes python is in your PATH. How do I add Python to the Windows PATH? - Super User

@EliasPolitis if you have time and can make a video, it would be a welcome data point to this discussion, and something to add to the bCNC wiki page that covers the editor : Editor · vlachoudis/bCNC Wiki · GitHub

I understand how it can be frustrating in the beginning. There’s a ton of features and the documentation is minimal. You can start with the basics (homing, jogging, loading, executing code) and then gradually discover more.

I have a big queue of organizing, making, cutting so I’m afraid I cannot promise a video sometime soon.

I’ll try to briefly give some tips for the sake of the discussion:

  • by selecting a line or multiple lines or a block or multiple blocks in the editor the visualizer displays the selected toolpaths
  • you can pick any place in the code, insert new line(s) and manually enter code
  • you can delete selected lines or blocks
  • unchecked blocks do not execute

One way to deal with the situation presented in this thread could be:

  • load your original.gcode
  • select one block at a time to see in the visualizer where the disruption took place
  • expand that block and browse through the code to find the exact spot or get as close as you can (you do not have to select and visualize each line if the code is long, just jump ahead and slow down as you get closer)
  • save as remaining.gcode (to keep your original.gcode intact)
  • keep a few lines above your new starting point to be sure you won’t crash into the workpiece (i.e. you’ll start cutting air)
  • delete everything between the program header and your new entry
  • make sure there is a safe Z entry as well (if not, manually enter it)
  • save
  • re-home if you suspect lost steps
  • run

[optional]

  • if the cut is critical/long/expensive temporarily set your lowest Z higher than the workpiece
  • verify that the remaining.gcode resumes where you expect it to
  • if you’re happy, set your real Z & run the real thing

It may sound overwhelming, but it really is straight forward. Manually editing code also makes you more confident and the outcome more predictable.

1 Like

I may get slammed for this but…
I went from UGS and ASPIRE to Mach3 and the difference is incredible. I can start mid file, go to any line I want, restart without losing position etc. I have not been able to put in a file that was too large etc. It is a night and day difference. In honesty I did not modify my X-Carve for this, I have went with a larger machine with individual drivers but I don’t see why you couldn’t just go from a Mach3 compatible board to the GShield. For me there is no going back.

2 Likes

no slamming needed. I don’t think anyone would argue mach 3 is a more powerful solution. I think for the sake of this discussion the OP is looking for a GRBL solution.

That’s the idea. Finding the “where it left off” is what it’s all about.

A line count is definitely helpful to get you there fast. Then sometimes depending on the complexity of the toolpath it might be helpful to “zoom in” the code and set your new start a bit earlier than the disruption. In this case, a viewer is helpful.

There is also Bob Warfield’s GW Editor, but it’s not free and it’s not a gcode sender. In bCNC having the gcode editor embedded in the gcode sender makes it super fast, especially for cases that something goes wrong and needs to be corrected on the spot.

Sounds like work best done repeatable and accurately by a machine/code, not a human