Every time I open up a G-code file and rummage around I learn something new. It is easy to add new lines which will instruct your 3D printer to work in different and better ways!

Transcript

Hey gang, Tim here at Core Electronics and today let's take a dive into what has become the universal control method for machines running under computer numerical control and how you can use it to 3D print better.

The G-code is a list of commands for the printer head to move to and fro and the print bed to go up and down and the temperatures of the system to be set as well as a whole bunch more. There are lines consisting of numbers and letters. There are various standards of G-code and some CNC machines insist on encoding their G-code to be read correctly and this makes it hard to access and alter them. However, there are other open source platforms which enable you to easily get inside and tinker to the betterment of everyone. On screen you'll be able to see an example of G-code line and a whole bunch of syntax underneath explaining what's going on with this line. For example, F in this example is 900 and that's 900 millimetres per second and that's how fast the head of whatever device this is will move. So understand that this is just a single line of a big G-code script. To create an entire 3D model or to carve out a chunk of material to a desired size you're going to need a lot of these commands.

In another image you can see a small section that can be used to print a 3D model which was produced by Ultimaker Cura. When you're 3D printing you can easily have a G-code which has thousands of lines. The easiest way to see a recipe for a 3D printer in all its glory is to save a Cura sliced file and then open it up with a text editor. Even notepad will work just by opening the sliced file like you would with any other text file.

So I'm going to start this process in Ultimaker Cura. Jumping into the computer you can see on screen a CAD file for a temperature tower which I will now slice. Temperature towers are used to find the optimal nozzle temperature for filaments and are a great way to dial in a 3D printer. However, Cura does not give you an option to change the nozzle temperature midway unless you install an add-on which will just alter the G-code in a similar manner to what I'm about to show you. So let us save this file as it is currently, dive into the G-code, proceed to rummage around, learn something and alter the G-code for these temperature changes ourselves. I will save it just like this making sure to save it as a G-code file. Now we have a G-code file let's display it.

The best tool I've found to help visualize each step in the G-code instead of it just being a wall of impenetrable text is to use Repetier-Host. Producing a 3D rendered view to help visualization and providing explanations to the syntax to make understanding the lingo of G-code much easier. Link down below for the download location and you can also see it on the screen now and I'm going to quickly install it here on this computer. So with this software installed I'm going to open up that G-code we just created from Cura. This section of the software shows a 3D render of what will be created using this G-code, in our case the temperature talent. This top right section shows the actual G-code in which you can scroll through and edit to your heart's content and the bottom right section shows the actual G-code that we just created from Cura.

This section of the software shows a 3D render in which you can scroll through and edit to your heart's content and the bottom right section has three tabs. The G-code syntax tab so you can understand what the numbers and letters mean, a visualization tab to help change what you can see in the 3D render section and the last tab gives a search option to find exactly the desired sections in the G-code.

Modifying nozzle temperatures is a simple starting point to altering G-code which is relatively safe. It is worth noting before diving too deep, remember that whatever command you give to the printer, it will do everything it can unless it hits a fail-safe or a limit to follow through with that command. So if you tell the machine to get the nozzle to a temperature where things can break, it's going to do just that. Take the time to double-check all of your commands that you have entered to make sure they are exactly what you want.

If we move our eyes to the top right of the box, we can see a G-code command M109 S250. If we select that line, we can see in the bottom right syntax box that the code M109 sets the extruded temperature and S tells the machine the following number will be a temperature value in degrees Celsius. This is the first time we've seen a temperature value in degrees Celsius. This is the first and only nozzle temperature decision that occurs and it occurs right at the start of this 3D print.

So what we're going to do is add more of these M109 commands with particular temperatures that we desire. This temperature tower has labelled on it 250-degrees Celsius at the bottom and it decreases all the way to 230-degrees in five-degree increments. So using the visualization tab, we can see that the next section of the temperature tower occurs at 114 layer height. So I will find this layer in the G-code by scrolling through.

Having found it, the very first thing that I want to have happen on this layer is for the temperature to decrease by five degrees. So I'm going to start a new line and type M109 space S245. Just like that, I've altered the G-code. Rinse and repeat for the next couple of layers and just make sure that you get the temperature correct.

Having completed this for each section of the temperature tower, you can then save the G-code using the icon highlighted here. Save this file to a USB stick or send it to your network to your 3D printer.

Ladies and gentlemen, we've done it. I printed this temperature tower here just a couple of days ago, and it really helped me dial in the temperatures for CPE. From this, you can see how much control you gain by having an understanding of what these slices are doing, and hopefully, this has inspired you to dive into the G-code yourself. And with that, until next time, stay cozy.

Comments


Loading...
Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.