Gcode editing

I created the gcode for my project in Estlcam a month ago. Now that I am ready to cut, my material thickness is deeper than I planned. Is there a way to edit the current file, change the starting level? All I really need is 4 mm.I had to play around with it to get some corners to fit inside another piece. And lets be serious, I dont remember what I had for breakfast today let alone a program a month ago.

Yes I could plane down my actual stock, but that might not always be possible.

As always, thanks for the advice

I mean… you ‘could’.

But it’d be a lot better to adjust the original design and use ESTLCam to create new code.

gcode is plain text. Once you figure out the language, it’s pretty simple
G0, G1 are your move commands. X Y Z are your three axis.
G0 Z-4 would move the z axis down 4mm.

You could go through the gcode looking for the Z moves and setting them to go farther down. One problem with that is that you would now be making a deeper cut. It might be preferred to do the extra 4mm in a separate path.

In this case, I’d probably just plane the block of wood down.

In future cases, I’d cut/plane/shape the material first, and then create that design based on that shape. That’s what I did with my most recent project.

1 Like

Is this a through cut? How many step down passes? The z moves are absolute, so every mention of G0 Zxx would need to be modified, and you may need an additional pass.

I like hacking G code, but in this case like David said it might be easier to regenerate the code.

Its a lidded box basically, with compartments, so some pockets, some thru cuts.

I’m not opposed to redoing the gcode, I just fiddled with the design till the the pieces all fit together well with minimal sanding. Only real problem is I didn’t save my progress as a project and have no detailed instructions only the original svg. I’m learning.

Basically I was cutting test pieces out of foam board. Made about 6 prototypes in one day.

Thanks for the help, always appreciate people sharing their knowledge.

Is it for the whole project, or just for one part (Say the outline)

EstlCam will basically do stuff like a slicer, using your DOC settings for your tool. There will be a series of moves where it plunges to depth, in increments of your depth of cut.

Let’s say you use 1.75mm as the defined depth of cut. You’ll see a number of moves (With a bunch of other stuff between them):
G1 Z-1.7500 F300
G1 Z-3.5000 F300
G1 Z-5.2500 F300

And so on. Say I wanted to change my code to do the same thing, but cut to 6.5mm. I could just increase the last pass, but that’s potentially bad news, since at some point I determined that 1.75mm is probably as much as I want per pass, and the last pass is not the one I want to plunge further than that.

I would probably do a bunch of global search/replace.

  1. Replace “G1 Z-5.2500” with “G1 Z-6.5000”
  2. Replace “G1 Z-3.5000” with “G1 Z-4.3333”
  3. Replace “G1 Z-1.7500” with “G1 Z-2.1666”
    (Somewhere in my brain I’m thinking “:g/G1 Z-5.2500/s//G1 Z-6.5000/g” – too many years using vi)

Well, maybe I’d make the numbers divisible by 0.0025 (One microstep at 400 microsteps/mm) or just round to 2 decimal places as being close enough. This will change your depth per pass

If instead you want to do only one part (say the outline) you would have to segregate that portion of the code (Fortunately EstlCam separates out parts, holes, drills etc into their own chunks, so at least you’ll have comments to figure it out) and then do the same thing. Remember that if you have holding tabs, there will be Z moves in the middle of everything, not just the start and end of a pass.

Can you do it? Well, okay… Should you do it? Probably not if you aren’t 100% sure you can deal with the increased DOC

Dan,
I understand what you are saying, but that is way above my pay grade, and in a completely different department. I appreciate the explanation, but I’m sure that is beyond my very limited abilities.

Yeah, I had a giggle on the vi comment… good times! I also like hacking gcode, but usually just simple stuff like adding or subtracting flood or mist, or adjusting laser power (also a one liner).

For something like this, I would consider it a learning mistake and redo it in cam. Sucks having to adjust stock at this point, but it is what it is.

When I started learning machining stuff that was outside of what I was trained to do previously, I had quite a few “that was dumb” learning moments. In fact I did the same thing as you, just with f360 instead of estlcam. I got all excited about a shipment of aluminum and wanted to have the Cnc ready to cut as soon as it arrived. Sure enough it was thicker than planned. Since then I always wait to produce cam until I have stock in calipers in front of me.

FWIW, I have done exactly this on a few occasions, and it has worked well.

@bmacoubrie what about offsetting your z to account for the thicker workpiece?

For example you would zero your initial run off the top of your workpiece and run the program. Then subtract your final cut depth from the workpiece thickness and do a G92 Z (your calculated offset value) . You’ll have to do that a couple times if the difference is larger than your original total cut depth.

This will take a little longer since you will be doing some cutting in air but I think it should work. You will also have to be sure that your Z clearance is larger than the difference you calculated so that the cutter doesn’t damage the top of your workpiece when it is moving to a different area.

Personally I would redo the program to make sure there are no issues but you could try this approach if that’s not an option. Probably be a good idea to try it in foam first if you do.

I went ahead redid everything, and I was wrong, my stock is thinner than my original design.

Now another question I have, is how can I add bit info into the gcode? I played with editing in Reptier, but how do you save it? Or open as a text file?

For Windows, I use Notepad++. Pretty good at not screwing up line ends for files that don’t use Windows conventions and deals with alternate codepages and sth well, too. (EDIT: Right click gcode file select “open with…” then find whatever application. Wordpad would probably be okay, but I hate the line wrapping.)

For Linux… Well, I still actually use vi, but don’t recommend it. nano maybe.

You can’t really change the bit because details like bit width, feedrates, depth of cut all have an impact on what XYZ to use on all those points in the file.

Make sure you save the project .e10 file (or whatever estlcam is calling it these days) and you can load that up, change something, save the project file, and export the gcode again.

1 Like

Brain blew a shift there somewhere, I had entirely the wrong question in my head when I wrote that last post… Engine revving in neutral…

Jeffeb3,
I saw in a video or read someone putting comments in the gcode to include bit info for future reference

You can change the comment, or the pause messages, but it won’t change the toolpath.

I was able to add the info in Repetier Host and save. Closed and reopened program loaded the file and it was there.