Cura Filament Change | Script & G-Code | Step by Step Guide

Martin

Disclosure: Links marked with * are Affiliate Links. I earn from qualifying purchases if you decide to make a purchase through these links – at no additional cost for you!


In addition to the ‘Pause at Height Script‘, Cura also allows you to use the ‘Filament Change’ post-processing script to change the filament during printing. 

With the Filament Change script in Cura, you can change filament mid-print at a specific layer. In the settings, the layer, the retraction and the filament output can be set. That way, you can change the filament color during printing.

How to do this in detail, which errors can occur and how to solve them, you will learn in this step-by-step guide. 

Step 1: Find the Layer for the Change in the Preview

Screenshot of using the Preview function in Cura to find the correct layer for the filament change.

You probably have an exact idea of where the color change should happen on your object. The height for this is specified in the filament change script in layers. 

To find the correct layer, you first have to slice the object without the script and then look for the correct layer in the preview. 

You can manually switch through the layers using the slider on the right side. 

The selected layer will be printed with the new filament after the filament change. 

Step 2: Extensions > Post Processing > Modify G-Code

Screenshot of where to find the post-processing menu in Cura.
You can find the filament change script here.

The settings for scripts are not found in the normal print settings but in the menu bar of Cura. 

Extensions > Post Processing > Modify G-Code

The distinction between print settings and scripts makes it clear that scripts should be made after the actual print settings. They insert special events into the print and do not change the actual print settings. 

Step 3: Add the Filament Change Script

Screenshot of where to find the filament change script in Cura.
The filament change script is only one of many scripts in Cura.

In the window that opens, you can add various scripts. The Filament Change script can also be found in the dropdown menu. 

With this menu, you can also insert several scripts one after the other. It is also possible to realize several filament changes in one print. Insert a script for the filament change for each filament change. The only setting you have to change is the layer number. 

Step 4: Adjust the Script Settings

In this step, you have to make the settings for the script. The most important setting is of course the layer count at which the new filament should be printed. 

Screenshot of the layer setting inside the filament change script in Cura.
Enter the correct layer numer here.

Layer: Here you determine the layer at which the new filament is to be used. After the previous layer, the pause is inserted and the filament can be changed.
It is also possible to insert several filament changes via the same script. You can list the different layer numbers one after the other separated by a comma. The same script will then be repeated for these layer numbers.

Screenshot of the firmware configuration setting inside the filament change script in Cura.
Some printers have a built-in filament change feature.

Use Firmware Configuration: Some 3D printers are equipped with firmware that allows filament changes during printing via the menu. This checkbox allows you to use this built-in filament change and perform it at the defined layer. On the printer’s screen a message like “Pause Print” will appear.
If you activate the checkbox, the settings for ‘Initial Retraction‘, ‘Later Retraction Distance‘ and for the X- and Y-positions disappear. These settings are then controlled by the firmware. 

Screenshot of the initial retraction setting inside the filament change script in Cura.
Start with your standard retraction distance.

Initial Retraction: Here you specify in millimeters the retraction length for the filament. The time of this retraction is directly after the last layer before the print head moves to the location of the filament change. This prevents a blob of excess filament at the end of the last layer. 

Screenshot of the later retraction distance setting inside the filament change script in Cura.
How far the filament will be retracted to be ejected.

Later Retraction Distance: With this setting, you specify how far the extruder should retract the filament. This value depends on which 3D printer you are using. If you want to eject the filament completely, this value should be at least as long as the length between the nozzle tip and the extruder inlet.

Screenshot of the X/Y Position setting inside the filament change script in Cura.
Where the print head should be parked in X-direction.

X/Y Position: Here you can set the XY coordinates for the print head. As soon as the pause for the filament change starts, the print head moves to this position to change the filament.
Most of the time the default zero position is useful. For some printers, however, a different position may be more helpful for changing the filament more conveniently.

Screenshot of the Z Position setting inside the filament change script in Cura.
Where the print head should be parked in Z-direction.

Z Position (relative): Just as with the XY coordinates, you can also specify the Z coordinate at which the filament change should take place. Be aware, however, that this value is calculated relatively. If you enter 0 mm, the printhead will not move to Z = 0 mm but will remain at the height it was at. If you enter 1 mm, it moves up one millimeter, and so on. 

Step 5: Slice the Object Again

This screenshot shows the warning that is displayed in Cura Slicer when a script is to be executed.
Cura script warning.

After you have programmed the script, you can close the window. Now you have to slice the object again to apply the changes. 

Once you have programmed a script, you will see a notice for it in the lower right corner of the Cura interface. 

As with the print settings, scripts are saved when you exit the program and retained when you start it. So that you don’t accidentally use the script again, this hint is clearly visible. 

Step 6: Start Printing

After you have sliced the object and sent it to your 3D printer, you can start printing. 

However, you should not let the 3D printer out of your sight for too long in order not to miss the filament change. If the 3D printer waits too long for you, the already printed material could cool down too much. With PLA, however, this is usually not a problem.

Step 7: Change Filament and Continue Printing

Once the script has started and the filament has been retracted from the 3D printer, you can install the new filament and continue printing.

If you did everything right, the color change or material change should be seamless. If not, there are several ways to optimize. 

Step 8: Use Filament Change Creatively

Picture of a 3D print that was printed with different filaments, using the Cura Filament Change script.
An octopus printed with two different filaments. The bottom layers were printed with purple filament.
Close-up of a 3D print that was printed with different filaments, using the Cura Filament Change script.

With the filament change in Cura, many creative ideas can be implemented. I have also used the script for many of my projects to achieve certain effects.

For this octopus, I printed the first few layers with a different filament than the rest of the object. This gives the suckers under the tentacles a different color than the body.

Troubleshooting – Cura Filament Change

Although the filament change script settings in Cura are quite simple, they can often lead to complications. Once you have found the right settings for your printer, it may take 1 to 3 test prints.

I would definitely advise you to practice the filament change with small test objects. Small test objects that only take a few minutes and a few grams of filament will keep you from ruining a larger print. 

Firmware does not recognize the script:
With older 3D printers, it is possible that the integrated firmware does not recognize the M600 command of the script. Then the printer will simply ignore the script and continue printing without stopping.
To check if the firmware of your 3D printer knows the command, you can open the configuration file and search for the M600 command. If it shows up, it will respond to the script. If you don’t find it, the printer will just keep printing as if the script wasn’t programmed.
If it is not there, you should update your firmware. Newer versions are usually compatible.

Blobs, zits and excess material at the transition point:
One of the most common errors during filament change is excess material at the transition point. The main cause of this error is an overpressure in the nozzle that has not been properly relieved.
The best way to relieve this pressure and avoid the extra filament is to retract the filament from the nozzle. There are two points in time at which the blob can occur: at the beginning and at the end of the pause. For the beginning of the pause, there is the setting ‘Initial Retraction’ in the script.
If the blob happens at the beginning, you should set the value here a little higher so that the filament is retracted further and can’t escape unintentionally. If the blob happens at the end of the pause, you have to make sure that after the filament change the filament doesn’t come out of the nozzle before the printer starts working again.

Warping or poor print bed adhesion:
Normally the print bed temperature should be constant during the script. However, there have been cases where the temperature has been set to 0°C for some reason, causing the print bed to cool significantly during the filament change.
When this happens, it can quickly cause warping of the first layer or cause the entire object to detach from the printing plate. If this happens to you, you should update your firmware as this should not happen.
Otherwise, you could use the script for ‘Pause at Height‘ instead of the filament change script. There you can define the temperatures manually. 

Layer Shift (shift in X/Y direction):
This problem is highly dependent on the 3D printer you are using. On some printers, you may experience more layer shifting when changing filament during printing than on others. It all depends on how easy it is to move the stepper motors by hand during operation.
If you accidentally change the XY position of the print head while changing filament, this will directly affect the 3D object. The 3D printer will not notice the misalignment and will continue to print as if nothing happened. As a result, all layers that are printed after the filament change are shifted by exactly this offset.
Therefore, you should make sure that you do not move the print head when changing the filament.

Height Shift (shift in Z direction):
This error is basically the same error as Layer Shift, only in Z direction. However, it manifests itself quite differently and is sometimes difficult to identify. If you have accidentally shifted the print bed or the X-axis with the print head in Z-direction during the pause, the print will start too high or too low after the pause.
In extreme cases, either the object can be detached from the print bed by the nozzle, because the nozzle starts much too low and collides with it. On the other hand, it can also happen that the nozzle suddenly starts printing again in the air when the shift in positive Z-direction has happened. Then there is either a small gap between the layers or you get the famous filament spaghettis and have to start over anyway. 

Poor layer adhesion:
Poor adhesion between the individual layers before and after the pause can not only be caused by an accidental shift in the Z-axis. During the filament change, the last layer that was printed cools down. So the new layer has to be printed on cold material. This can lead to poor adhesion with some materials. You could then try to raise the printing temperature or standby temperature for the new layer by a few degrees.
Poor adhesion before and after the pause is also common when you change the material and not just


Disclosure: This website is the property of Martin Lütkemeyer and is operated by Martin Lütkemeyer. Martin Lütkemeyer is a member of the Amazon Services LLC and other Affiliate Programs. These are affiliate advertising programs designed to enable websites to earn advertising revenue through advertising and linking to Amazon.com and others. Links marked with * are affiliate links.

Leave a Comment