Gcode

You have to tell the printer what to do and this is generally it. The slicer produces gcode and the printer reads the gcode and does it. It is code that controls the printer and most statements start with a G. The rocket surgeons figured out the name gcode.

Most, probably all, the stuff that uses gcode, the slicer and the printer primarily, work with files with the extension gcode. If your printer can not find the file you sliced probably the extension is, somehow, not gcode. A sliced thing ready for printing is probably in thing.gcode.

Like pretty much everything in 3D printing gcode was taken from somewhere else and used for 3D printing. Gcode was created for CNC, Computer Numerical Control, machines to they could make stuff. I’m not sure if there is an organization that has control of all the gcodes. There is agreement on most.

If you want do draw a line from where you are to a point 1x and 1y while extruding filament away you might have G1 X1 Y1 E1. If you wanted to set the hot end to 213c you might have G104 S213. Marlin software has a pretty good explanation of gcode.

Some gcodes are for specific printers, the codes used by Bambu to change filament, may not be supported by all printers and slicers.

There are usually three sections of gcode. First there is a section that sets stuff up for the printer. This is probably dependent on the printer. The slicer usually copies this code from an area called something like start code. It usually is copied without change and is setup by the user. A lot of slicers have start codes for a lot of printers and you can pick one to use. Most of the time the user can make changes to this code. Things like the purge lines are in this area and if, for some reason, you want something different, go for it.

The second section is produced by the slicer and it is the instructions to draw the thing. The slicer takes the geometry from the STL and it’s parameters to build this section of gcode. A parameter like wall speed is used by the slicer to produce gcode that moves the head at a speed.

Finally there is a bit of gcode after the thing is printed. Like the start gcode the slicer generally copies this from an area, usually called end code. A lot like the start.

Gcode is real simple. It does one thing. For example if you want the bed to be 50c and the hot end to be 213c, there is no command for this. You need one command to set the bed to 50c and another command to set the hot end to 213c. There are differen t commands to set a temp and wait to reach the temp and set a temp and continue command. So four temp commands.

Gcode files are in text and can be edited in any text editor. Some slicers will produce and some printers will use binary gcode. This is not meant to be read or messed with by humans.

Gcode for one printer usually has problems on another printer. A speed the second printer can not reach might be used. The amount of plastic extruded might be different. Both printers can probably read the gcode, but what happens may not be what you want. It is best to take the STL and use a slicer to produce gcode for each printer.