G Code is the language used to tell automated machines how to make something in steps, in the case of 3D printers, G Code is a set of commands that instructs printers to create 3D objects. In the case of FDM printers for example, G Code controls the printer’s nozzles’ movement, and it controls the speed and the amount of filament to be used in each move.
Here is an example snippet of G Code :
The G Code file is produced by 3D printing software usually called a slicer, the slicer generates horizontal layers “slices” from the original 3D model as it is scaled and rotated by the user, and then writes the G-code commands to print those layers depending on the user, and printer-specific settings.
Each printer has different nozzle heads, each of which requires different extrusion and speed settings in the G-Code, which means, every G-Code is generated to a specific printer, and can’t target different printers and sometimes, even if they were using the same firmware as the printer targeted by the G-Code.
Filament materials have different behaviors and require different G-Code settings, each type of plastic used in FDM printers, for example, requires different heating temperatures by the nozzle head, and different speed variations, in order to print the layers which shape the print, this means that filament materials also affect the commands generation, and in order to alter the G-Code to use a different material, you will need to regenerate the G-Code using the original 3D model.