Gcode noob needs help

So I watched a video that Ryan put on the site by “Some Old Guy” (His words, Not mine lol).
In it he explains tool changes and one method caught my eye.
G0 Z0 -Moves Z to Material
M84 S999 -Keeps motors engaged
M18 Z -Releases Z motor
M00 -Pause for Operator
I like this method. Aside from the fact that it will stop above the end of the last cut.
Thus you would have to assume where the material top should be while resetting your Z axis
after your tool change.
The other method involving moving your tool to a safe location is nice but you would have to
alter your safe location for every different project because you will position your tool holder at different location for different jobs. I’d like to have one easy script to remember.
For safe could I use G0 X0 Y0 Z0 ?
Because wouldn’t that be my starting point/Stock Box point? That would most likely then be on
the topside of my stock and I wouldn’t have to worry about then locating the material topside on a spot that’s already been milled.
Now, on to my next question.
I’ve never played with gcode before in its raw format. I’ve always just let Fusion 360 spit
out whatever it does after I post. How do you add it? I already assume that when fusion posts the code I can then transfer it to notepad and add this script somewhere. but is that it? Did I answer my own question?

Yes, I think you answered your own questions! GCode can be edited in NotePad / WordPad, I typically change speeds on some moves. (i.e if is moving 500 mm to the next cut, I speed it up - as it isn’t cutting (using the F command). I think using G0 X0 Y0 Z0 is OK, as it should move to X and Y before lowering Z - but I like to lift Z with G0 Z10 (or something, to clear the material), then use G0 X0 Y0 .


Check out this thread it may answer some questions:

Spindle power control

I use Estlcam and there is a place to insert a tool change script. Every time I save the gcode, it puts the lines in automatically, not sure if Fusion 360 has an option like this.


0,0,0 is a good place for the safe place, as long as you didn’t have a cut there. If you were cutting a square, or example, then you might be likely to put one of the corners at 0,0,0. Making your origin on some repeatable, not cut part of the workpiece is a good idea even for one tool setups, because if the power goes out, or you skip steps or something else goes wrong, you can kill it, and then you can reset the 0,0,0 at that same safe place, and start the job again. You might get close enough to salvage the part. I’ve saved a few projects this way.

G0 X0 Y0 Z0 will move in a straight line towards that 0,0,0 point, so it will be moving in z as well as x, y. This would be safer (as CamOnt pointed out):

G0 Z3 G0 X0 Y0 G0 Z0

That will move to your clearance plane (if your clearance was at 3mm). Then move x, y, then drop down.

If you didn’t do that, and your last location was in the part, for example, you’d move in a straight line, through your workpiece. If your last z was at the clearance plane, and 0.5m away from the X0, Y0, then the last 0.05m of travel, you’d be at 0.03m above your work, which is pretty close. So you really want to travel in your Z clearance plane.

You can also add some F numbers to those commands, because otherwise it will be moving at the cutting speed. F is in mm/min, so to travel at 50mm/s, you’d put in F3000. For the Z F number, I think you want something smaller, because the recent versions of Marlin have been getting in trouble with high z speeds.

Lastly, you can test all this without doing a whole part, you can write gcode from scratch, no problem. G90 is the only command you really need at the beginning, to force absolute, instead of relative coordinates:

G90 ; Absolute coords G00 Z2.0 F300 ; Up to clearance plane G00 X10 Y10 F1500 ; Go somewhere G00 Z0.0 F300 ; Down to work G00 Z2.0 ; Up to clearance plane G00 X0 Y0 F3000 ; Back to 0,0 G00 Z0 F300 ; Down to work M84 S999 ; Hold motors M18 Z ; release Z M00 ; Pause

Hopefully, you can read that gcode, and if not, then try it out, and play around with it, either in foam, or just without the tool.

Marlin treats G00 and G01 the same in the current iteration, but those could have been G01 numbers instead. On other firmwares there are different speed settings for G00 and G01. I made a much longer post about G00/G01, the max speeds, and accelerations and marlin/grbl somewhere around here.

I’m not understanding the G90 command. Define absolute.

And F commands are speeds?

Aside from me not understanding the purose of G90… Am I on the right track with this?

G0 Z5 -Moves Z to 5mm
G0 X0 Y0 F600 -Moves X,Y to origin, 600 mm/m
G0 Z0 -Moves Z to Material top
M84 S999 -Keeps motors engaged
M18 Z -Releases Z motor
M00 -Pause for Operator

My start point is always topside of my stock usually on the lower left hand corner of my workpiece. Away from my cut. So 0,0,0 would always work.

Is G0 the same as G00?

Absolute coordinates mean that coordinates (x, y, z) are going to be relative to the starting location. Relative is the opposite, and X, Y, Z coordinates are going to be relative to the current location. You don’t really need to worry, except that if you are running an entire gcode file, you want to make sure you’re setting it to G90 at the beginning. The output from autocad already does this, so if you are just adding lines to an existing project, don’t worry about it. If you are writing a file from scratch, to play with, then you need to add it. If the machine was last used in relative coordinates, then your x, y, z will mean something completely different.

G0 is the same as G00.

The F part is speed, and it’s “sticky” so the last F you used is the speed that will be used in the next G0/G1 command.

That gcode looks fine, as long as you remove the “-” and everything to the right of it. I think that text is meant to comment the gcode, but AFAIK, “-” isn’t a valid gcode comment character, so it should be this:

G0 Z5
G0 X0 Y0 F600
G0 Z0
M84 S999

Others, is F600 too fast for Z moves with Marlin? I don’t remember the number you were setting to keep Marlin from crashing.

IIRC you need to keep Z under something close to 8mm/sec (7.something?) so F420 is safe, F480 is potentially too fast.

I cut at 400 mm/min. Now if our machines have a threshold of 420ish… That makes me think I’m cutting too fast. I probably should even drop it down to around 200 mm/min for aluminum eh?

That number is for the z axis. The x y speeds should be much faster.

To be clear, here’s where it matters:

In your gcode you worked up, add an “F420” to the z moves. You can keep the x/y moves at F600.

I ended up reaching out to Lars Christensen a few days ago after the Autodesk Fusion 360 High speed machining event I went to about figuring a way for Fusion 360 to do this on its own. I wanted to ask him while I had him in person but forgot. He’s not confident in his post processor editing skills but pointed me into the direction of people who can. So right now one of the Autodesk Elite are editing the post processor for me to include my tool change script.

G00 Z10 F400
G00 X0 Y0 F600
G00 Z0 F400
M84 S999
M18 Z

I entered a value of 400mm/min on the Z axis just to play it safe.

If all goes according to plan, Every time Fusion 360 notes a tool change it will automatically
stop, go back to the origin, and wait for me (or whoever) to change the tool. I’ll post the
revised post processor here when I have it for anyone who wants to use it.

Sweet! I think it is getting stable enough to see if I can get them to add us to their list of postprocessors. Thanks for helping out.