More often we hear about Gcode and the need to change it according to personal preferences. Gcode is a real language and allows us to make our CNC machine do anything. We can change the welcome message, insert a melody, until we conceptually change the movements. The interface that allows you to create Gcodes suitable for our 3d printers are special software called Slicer.
Many times in this blog we have talked about slicers, particular programs designed to transform a model into machine language, the GCODE. These software create the paths that the nozzle will have to make and determine how much material to deposit, in total autonomy, to form the finished object.
It is true that human intervention and intelligence can be useful in finding the best position in which a given object should be printed to minimize the supports or possible errors, as well as it is decisive for various settings, depending on the type of material in use or other factors that the machine can not know.
Once this is done, however, the software proceeds autonomously to form the GCODE, that is, the set of movements combined with extrusion that are performed in the order and with the perfect times, typical of electronic brains, that create our object, exactly as it was thought and designed.
What do we need to know about Gcode commands then? If the software does everything by itself, why should we intervene and communicate with the machine?
The answer to these questions, which anyone will have asked themselves at this point, is one and simple: Customization.
We know that each machine is different, as components, project and software, (of course I’m talking about different models and brands, equal machines will behave in the same way) and as different will have different defects.
To get to correct these defects or simply if we want our machine to perform certain operations at the beginning or at the end of a print we could impose it by adding the commands of the GCODE.
For example, for a lower power consumption we could tell our machine to turn off the nozzle, the plate and the motors at the end of the job, in this way we could not be present at the end of the print, but we could also introduce ourselves a few hours later knowing that we have not “paid” that time. Or, if we had a probe for the levelling of the plate we could decide to level the plate to the probe before each print, to be sure of an excellent result.
These changes can be made in 2 ways:
1 – Through the slicer. Each slicer has a special space where to insert the head and tail Gcode. Once we have found this space, we just need to add the lines of code corresponding to the commands we want to give and the machine will automatically complete them in each print. An example of a rather common start and end Gcode is the following:
BEGINNING
- G28 X0 Y0 Z0 – Home all axes
- M107 – Turns off the layer fan if it is on
- G1 F200 E3 – Extrudes a small amount of filament to ensure that the wire is loaded
END
- G28 X0 Y0 – Return to zero in x and y
- M104 S0 – Extruder power off
- M140 S0 – Flat switch-off
- G1 E1 F200 – Portrays a little filament
- M84 – Turn off engines
2- As a second method, less orthodox than the first, we can have our favorite slicer process the gcode and then open the file with the notepad. Through the notepad we will see all the commands and we can intervene adding or removing commands at will. With this method you can also intervene in the heart of the processing, inserting pauses or any other high command to meet our needs. Obviously going to touch a gcode is not easy and if you are not an expert you risk to have more damage than benefits.
Having said this as promised here is the list of Gcode commands, a kind of dictionary Man-Machine-Machine-Man. As for the languages it will not be enough to know the words but you will have to compose real phrases, you will have to follow the correct order of the commands if you want to be understood by your interlocutor: the machine.