In today's video I want to talk about one simple gcode command: G92. Let's go.
G92 has the somewhat uninteresting name of "set position" in the marlin firmware documents so it's
easy to miss, but you really shouldnt - it's potentially one of the most useful
gcode commands that we can leverage to customise our already generated gcode.
If you don't know already, I'll just briefly explain that gcode is the language your printer
understands, when you put a model into your slicer and generate a gcode file that's what you send to
the printer and that is a plain text file with a list of potentially human readable commands,
meaning readable to nerds like me. But I think everyone should try to learn gcode,
in fact I did a survey recently and I got the feeling that a lot of you want to
master gcode, so expect more of these videos in the future.
What the command does, is actually simple. G92 resets the
axis or axes you specify to the place you specify.
I'll explain with an analogy. You're, lets say, lining up boxes in a warehouse, because your
boss has pointed to an area in the warehouse to put the boxes and said "start putting them here".
You put a few boxes down and are working away and then your boss comes in, and as bosses always do,
he tells you no. Not there. Idiot. Who told you to put them there? Do that again and you're fired.
And he points to another part of the room, put them here from now on. So what do you do? from
that point on, you start lining them up the same way in the same pattern but from a new location.
What your boss has done here, is reset your start location for placing the boxes.
And that's what G92 does.
Here's a calibration cube gcode, we all know what this is supposed to look like.
I'm going to just print the top couple of layers of it for expedience and to show how this works.
I'll place it somewhere on the left of the bed, for reasons that'll become obvious momentarily.
Now if I go into the gcode, you can see here that we have some start code first,
this is your actual cura start code just pasted in here,
but then you get to layer zero. This is where the actual print starts.
If I cut and paste everything from the start to the end which is where you see something typically
like "time elapsed", and I paste another copy of all this, and at the beginning I put in two
commands, the first being an x position, and then the second being a G92 command,
when I print it, you will get not one cube, but two identical cubes one to the right of the other.
What I've done here is told the printer to move to a new position on the bed,
but then told it "and this is now x equals zero". I'm redefining the area it prints in,
essentially. Notice that I supplied only the x axis parameters,
this is one of the features of the G92 command, you can supply any number of X, Y, Z or E.
Another cool trick, if your purge line is too far to the left, in your start code you
can just insert a command to move maybe 10 units to the right, and then redefine that
as x = zero. I have this issue on my neptune 2S where the x stop and the bed don't quite line up.
One thing you see a lot in gcode, in fact you probably saw it a moment ago, is the command G92
E0. The extruder tends to run in what's called absolute mode in cura, less so in prusaslicer,
what this means is it keeps a record of its exact position,
how far it has extruded since it was last reset which is often the beginning of the print.
It's useful to know this, if you ever want to issue an extrude command directly in the terminal,
maybe you've fallen for this in the past at some point where you try to extrude with say G1 E100,
and the extruder has retracted a huge amount. It's doing this because it's in absolute mode,
and the current position is probably just effectively a random number.
You can reset it first with G92 E0, then the extrude command will work.
By the way, since this is a video about gcode it seems like a good time to point
out that I made this - it's pretty simple but useful, it's a quick reference sheet
to the most popular gcode commands. I made it a while back and shared it with patreon subscribers.
If you are a patron you can pop over there and download this and print it
out and fold it into four and stick it in the drawer under your printer if it fits.
So let's talk about start code. You want to change your z offset in start code? Once you
know how G92 works, it's easy. The usual method of doing this is by some weird subtraction,
to avoid negative numbers I guess. So if you want your first layer to be RAISED by 0.3mm,
in your start code, move the Z axis up to Z0.3, then tell the printer that's now zero.
This is absolutely the same as if you raised the Z axis up to 10.3,
and told it no, that's actually 10, because you can supply a parameter.
So all these commands are equivalent and all would add a 0.3mm offset.
For a negative offset, Same thing. Move up to say Z=1 and then tell the printer nope,
this is 0.7. Congratulations, you can now scratch a 0.3mm line into your bed surface.
It's a reasonable logical leap to take this concept and say hmm. What if I want
to print on top of something? What if I want to print on top of an existing print
or object. Of course you can. Just generate your normal gcode, and in the top of the gcode
before it starts printing just issue the same commands, Move up to where you _really_
want to start and issue an M92 to gaslight the printer into thinking it's now at Z=0.
There's probably a million other uses of G92 that I haven't mentioned,
so if you use it for anything let me know in the comments. Is this useful?
I can do more short gcode videos in the future if you want, let me know that too in the comments.
Also, yes, the stepper motors video is still coming, hang on..
...there you go. That's the line up. At least until it changes again. I'm gonna
be releasing a lot of videos in the next few weeks so make sure you're subscribed,
I'm talking to you, 80% of people who aren't subscribed.
Anyway - see you next time!