Change Filament At Z Cura Plugin

by rawlogic, published

Change Filament At Z Cura Plugin by rawlogic Feb 1, 2017


UPDATED v3.2: If your plugin doesn't display a version, it's v1.0. The latest version is v3.2. Please keep coming back for updates or click the Watch button.

"ChangeAtHeight.py" is the Cura 2 and Cura 3 version of the plugin. "changeAtZ.py" is the legacy Cura 15 and Cura 16 version.

DESCRIPTION: With a single extruder printer, sometimes you want to switch filaments during a print to make something a little different or just pause at a particular layer to insert something.

The plugin, once installed into your Cura plugins folder, shows up as the "Change filament at height" plugin.

Usage (with default settings):


  1. Switch to the layer view and determine the layer which you want to pause at. It will pause at the beginning of the layer that you choose.
  2. From Cura's main menu, choose Extensions->Post Processing->Modify G-Ccode
  3. Click the "Add a script" button
  4. Choose "Change filament at height"
  5. Enter the desired layer in the "Pause at layer" box
  6. Click the "Close" button
  7. For additional pauses, simply repeat
  8. Save the G-Code file to an SD card

The "Cool extruder on pause" feature is not compatible with multiple extruders. It won't know which extruder to heat back up or which temp to use. So, disable that feature if you're using multiple extruders.


  1. Print the file from the SD card
  2. The printer will pause at the designated layer, turn off the extruder heat to avoid burning the filament in the nozzle, then beep to get your attention
  3. On the printer's control box, under the SD Card menu, choose "Continue Print". The printer will lock the stepper motors then beep. If you are inserting items, now's the time to do it.
  4. When you are ready to change filament or resume, choose "Continue Print" again, and your extruder will start heating back up to temperature. Once the extruder is at temperature, the printer will lock the stepper motors then beep again. If you are changing filament, now's the time to do it.
  5. Once you've changed the filament or are ready to resume, choose "Continue Print". The plugin will immediately prime the nozzle, then beep again.
  6. Wipe the nozzle then choose "Continue Print" the final time to resume the print.

In summary, here's the sequence each time you "Continue Print":

  1. Lock stepper motors (insert items)
  2. Heat up extruder (wait for it...) then lock stepper motors (change filament)
  3. Prime nozzle (wipe)
  4. Resume print

See the photo of my dragon print for an example of how well it works. The print was tiny. The photo shows the print sitting on my computer keyboard.

Here's the project that I actually designed this plugin for:
Personalized Glowing Valentines for Kids Remake
Here are my latest change filament projects:
Magnetic Construction Toys
No Soliciting Girl Scout Cookies Sign

IMPORTANT: If you set a value for "Move print head Z", it will attempt to raise the nozzle by that amount from the current z height, up to the max your printer allows. Leave the "Move print head Z" parameter at 5mm to move the head up 5mm from the print before parking. Setting it to 0 still raises it a minimum of 1 layer. If the current z height plus the value that you enter is less than 25mm, it will raise up to a minimum of 25mm so that you have room to work under the nozzle. If you put in a large value, you could possibly ruin your print or damage your cables (if your printer configuration reports a larger max Z than it actually allows because of cables, extruder height, etc.). Avoid using X and Y of 0 and 0 because your printer may hit your limit switches, causing it to lose a step or two. For my printer, Park X and Y of 10 and 10 puts it in the front left. 190 and 190 puts it in the back right (depends on your bed size). The plugin only pauses if you are printing from an SD card or Octoprint.

Cura 2 or 3 INSTALLATION: To install, simply close down Cura, drop the ChangeAtHeight.py file into the Cura PostProcessingPlugin plugins folder, then restart Cura. My plugins folder, using the default path, was at: C:\Program Files\Cura 2.x\plugins\PostProcessingPlugin\scripts for Cura 2.x and C:\Program Files\Ultimaker Cura 3.x\plugins\PostProcessingPlugin\scripts for Cura 3.x.

Verified Printers:

  • Wanhao Duplicator i3
  • Wanhao Duplicator i3 Plus
  • Monoprice Maker Select
  • Monoprice Maker Select Plus
  • Balco 3D Printer
  • Balco 3D Printer Touch
  • Prusa i3
  • Anet A8

Possible Printers:

  • Malyan M150
  • Cocoon Create
  • Tevo Tarantula I3
  • Any Repetier firmware printer

Does NOT work with these printers

  • Monoprice Maker Select Ultimate
  • Ultimaker
  • Ultimaker 2
  • Printrbot simple metal
  • Anycubic i3 Mega

If you have a compatible printer and this plugin works for you, please let me know so that I can add it. My Monoprice Maker Select uses the Repetier firmware. I'm guessing that this plugin will work with any Repetier firmware based printer. The Marlin firmware seems to support all of the same commands, so it should also work with any Marlin firmware based printer. Thank you.


  • If you are not printing from an SD card, this plugin will not work! It will not pause! You must print from an SD card (or with Octoprint)
  • Some versions of Cura have a bug and don't automatically reslice when you add the post processing plugin to your project. You may need to force Cura to reslice. This can easily be done by, e.g. turning retraction on and off.
  • If you are printing a large model, you may wish to ensure that the pause is present in your G-Code file before you start the print. Simply open up the G-Code file in a text editor and search for the text "CUSTOM" to find the G-Code that was added by the plugin.
  • You will need to install the plugin for each version of Cura that you install onto your computer.
  • The plugin pauses at the beginning of the layer that you choose.

Version 3.2 Changes:

  • Fixed bug where the plugin wasn't looking for resets to the extruder position in the middle of the print (why, Cura?), so it was setting the extruder value to the wrong value when resuming print (Thank you, papavomsee)

Version 3.1 Changes:

  • Fixed bug where the plugin wasn't finding extruder temperatures before the first layer, so it wasn't resuming at the correct extruder temperature for some users. (Thank you, poswald, eyal3388, and alexanderfreddy25)

Version 3.0 Changes:

  • Added option to choose the layer by layer number or by height (Now defaults to "Layer" because it's so much easier. Just use the layer preview. No more maths!) (Thanks for the motivation, RustyCrackleford)
  • Added option to cool the extruder on pause (On by default) (Thanks for the suggestion, RustyCrackleford)
  • Added option to turn off the beep

Version 2.0 Changes:

  • Added retraction parameters for greater control and especially for those with Bowden tube printers
  • Added retraction distance parameter
  • Added extrusion distance parameter
  • Added prime distance parameter
  • Lowered default retraction (and extrusion) from 7mm to 5mm

Version 1.3 Changes:

  • Added retraction immediately after the cleanup stage to mitigate any oozing while it moves to the resume location

Version 1.2 Changes:

  • Reset the extruder position in case the last movement was a retraction, which avoids extruding extra material when it restarts
  • Fixed to work with multiple filament changes (at different heights) in the same project

Version 1.1 Changes:

  • Renamed the "Head park Z" parameter to "Head move Z" to more accurately portray what the parameter does
  • Ensure that we always raise at least 1 layer
  • Ignore negative values for all parameters (defaults to 0)
  • Changed default "Head move Z" value from 0 to 5

Cura 15 and 16 are no longer supported and will not receive updates for this plugin.

Legacy Cura 15/16 Change Height at Z v2.0 Plugin
Cura 15 INSTALLATION: To see the plugins, you'll need to switch from "Quick print" to "Full settings" in the Expert menu. To install, simply close down Cura, drop the changeAtZ.py file into the Cura plugins folder, then restart Cura. My plugins folder, using the default path, was at: C:\Program Files (x86)\monoprice\IIIP\IIIP15.01\plugins

The plugins folder for the downloaded version of Cura 15 was at: C:\Program Files (x86)\Cura_15.04.6\plugins

Interestingly, the plugins folder is not IN the Cura folder, but next to it.

(Wanhao) Cura 16 INSTALLATION: To see the plugins, you'll need to switch from "Quick print" to "Full settings" in the Expert menu. To install, simply close down Cura, drop the changeAtZ.py file into the Cura plugins folder, then restart Cura. My plugins folder, using the default path, was at:C:\Program Files (x86)\WANHAO 3D PRINTER\WANHAO-16.01\wanhao-cura\plugins

Print Settings


Maker Select 13860










I printed the dragon at 0.1mm resolution. The background layer is 0.3mm thick, and my first layer is set to 0.2mm, so I set the plugin "Change Filament at Height" to 0.4mm, which ended up being the third layer. This allowed me to change the filament from clear for the background to orange for the dragon.silhouette. Alternatively, I can just choose Layer 3.

More from 3D Printer Accessories

view more

All Apps

Upgrade this Thing with Thingiverse Apps

Tools and Utilities

Repair, slice, or enhance this Thing

Quickly Scale, Mirror or Cut your 3D Models

App Info Launch App

I am using CR-10.
Can I change so it does not pause 4 times, but only 1 time.
Otherwise, really nice plugin.

Comments deleted.

Verified on my Tevo Tornado!


Worked well on my anycubic kossel!
I used it for a small bitcoin. Now i want to add the script to another model and it wont add it in the gcode? Is there a solution?
I tried it with the bitcoin again, and it added the custom text without a problem.

Still wont work. Its adding the gcode just in layer 27, does not change when choosing other layers like 24...

Comments deleted.

What about replacing M25 with M600 (Only Marlin compatible) ?

I've considered doing that, but this plugin does more than most M600 implementations. There could also be some duplication for some M600 implementations. It's hard to tell if they're going to save the location and go home, if they're going to retract, etc. This plugin gives you more control and ideally works similarly for everyone.

What printer do you have and what would you gain by replacing M25 with M600? Would you want to replace everything that this plugin does and just do M600 at a specific layer?

Thank you for your reply,
I use an Anet A8 with Marlin 1.1.8.
I think M600 should have a better integration and it's maybe easier to use for newbies. It's just an idea.
Your project have the advantage of customization.
Great job anyway, you did some cool stuff.

hi cura 3.2.1 doesnt see the plugin anymore, you dont see it in modify g-code option, and get error msg when you try to install it

Thanks for the heads up. I hadn't realized that there was an update. Please make sure that you shut down Cura before you copy the plugin file over and make sure that you put it in the right folder. Cura won't see the plugin if it's not there when you start Cura.

I installed Cura 3.2.1 into a new folder so that I could keep Cura 3.2. I copied the plugin to the right folder for Cura 3.2.1, then started Cura, and it appeared to be working properly.

What folder does the py file go into?

Nevermind, I found it... C:\Program Files\Cura 3.2\plugins\PostProcessingPlugin\scripts

I love this plugin, I use it for a general pause as I like the beep etc. Still have yet to use it to change colors

I do have a suggestion for the next version. It would be nice to be able to change the M117 text. Since the addition of the M117 Speech synth octoprint plugin ( https://plugins.octoprint.org/plugins/M117SpeechSynthesis/ ), it would be a nice addition to be able to change the text for the "Press continue..." But I would like to change it for each spot separately. I know I can go into the .py and change it if I really needed but it would be a good feature to be able to change it through Cura.

Thank you for the good suggestion. I'll see if I can add that to the next version.

Cool thank you.

Comments deleted.

Successful on the Balco 3D Touch Printer - (Cocoon Create) / Wanhao Duplicator i3 Plus

Thank you. I added it to the list of supported printers.

Wrong one oops.

Hi there. Thank you for this script.
I have a CR-10S with 1.1.7 firmware and use Cura 3.1, along wth Repetier Server 0.84. I do NOT print from the SD Card. (not sure if that is an issue?)
Upon reaching layer 3 the printer beeps, and on the screen of the CR10 the Press to Continue message comes up but as soon as it reaches the new "home" position the extruder goes back to where it was printing and continues printing without giving me time to do anything.

Any help?

Unfortunately, our firmwares only support the SD card pause command, so if you're not printing from the SD card, it won't pause. Read the description for more info.

It works for Wanhao Duplicator i3 Plus but doesn't beep.

Thank you for letting me know. I added the Plus to the list.

There is a bug in the extruder position (sometimes?).
I'm using v3.1 with Cura 3.1 and a Creality CR-10.

I made nearly identical prints with the script without problems.
Now I have one where he set a totally wrong absolute extruder position at the end.
Leading in endless rewinding filament :/

Look at the yellow marks on the screenshot

Nevermind. I found the issue. It's fixed now with v3.2 of the plugin. Thank you for the info!

Great news :)

I add the file anyways, maybee you want to check if it is really the bug you fixed.
The wrong Extruder Number is used at a earlier stage of the gcode.
Then there is a reset of the Extruder to 0(as far as I understand).

Thx for your great work :)

Edit: I just saw your explanation of version 3.2. Sounds really like my bug :)
And I have also no idea why Cura did this.
I made the identical sign for another kid (only other Name) and the print worked fine.
Maybee a strange "change options/reslice" behaviour from cura.

Yeah, it was the reset to 0 that I didn't account for. Why Cura does this is unknown. Anyway, now I watch for "G92 E0". Thanks again.

Sorry about that. Can you provide the whole gcode file, please? It must have gotten that E9879 value from somewhere. I'm trying to figure it out. Thank you.

Comments deleted.

Hi there,

I'm using v3.1 with Cura 3.04 and a Creality CR-10.
Step three (prime nozzle) does nothing. No Extrusion at all. (Edit: in a second try extrusion worked, no idea why)
I pushed the filament manually until the new color comes out.

With vase mode (spiralize), the printer does not print instant after resuming, there are a few centimeters until the new filament comes out.
So the vase is broken :/

Any ideas what I can do?

So I think I may have found a bug or something. Since installing the new version, after Step three, the print head moves into place to start printing, when I hit continue, the extruder starts unloading the filament. After about a minuet, it attempted to start printing.

I have removed / replaced the plug-in, but this continues to happen. Any suggestions. This did not occur with the last version, I am runnuning this on my cr-10. This also happens on my monoprice maker select plus.

It's probably just heating up the extruder. If you're going to babysit the printer and don't want it to cool down when it pauses, then turn off the "Cool extruder on pause" option.

Then why is it reversing all the filement out then starting to print? This seems to be happening during the third pause and continues until the print is finished.

Anyone been able to, or figured out how to, add this to the new Linux appimage?

Question... If I have an object with 10 layers. I want layer 1-5 to be black and layer 6-10 to be yellow. Do I input layer 5 or 6 into the pause at layer? Basically does it pause at the beginning or end of layer?

Layer 6. It's at the beginning.

I upgraded my Cura to 3.1, and now I can't get this plugin to even show up under the extensions. I downloaded the new version, installed it as I had before.

I am using the "color change" that shows up, but i don't like it, it leaves a big blob when the hot end pauses. Any thoughts? I am using iMac desk top.

Never mind, I got the problem fixed. Seems when I upgraded to Cura 3.1, it created a new folder called "Ultimaker Cura". I was attempting to install the plugin in the regular "Cura" folder.

I got it up and running, seems to be working perfectly. This is the first vase I printed using this plugin.

Thanks again for creating this wonderful plugin!

Nice print.

I'm glad that you figured it out. I was going to install Cura 3.1 on my Mac last night and try it out, but then I got distracted and forgot. Sorry!

I noticed that they also changed the install folder to Ultimaker Cura on Windows, starting with Cura 3.0.

on my CR-10 the first it didnt work (1st try, will try it again tomorrow).

1st resume print: locked the steppers (I think so).

2nd resume print: Hot End heated up (so I could change the Filament).

3rd resume print: Print head went to the start position for the Layer.

4th resume print: Extruder took out the Filament, after that it started printing (without Filament)

would be nice if this could get fixed, if possible :)

This was fixed in v3.2 of the plugin. Please download the latest one.

Same here with my CR-10 Mini. After resuming printing, the extruder kept on Retracting and Extruding the same amount of filament over and over again for the rest of the print. This resulted in no filament was coming out of the nozzle, hence "printing without filament".

This was fixed in v3.2 of the plugin. Please download the latest one.

I'm having this exact issue and can't for the life of me find the cause. A dozen test prints now and every time I resume printing it retracts and extrudes the same amount and nothing comes out. I've tried zeroing the retraction and extrusion distance, but no effect. Gcode for test print attached.
All the "continue" steps seem to work as intended except for no beep, even with the option selected and appearing in the gcode, and no messages printed to the touchscreen.
Setup: Cocoon Create Touch (Wanhao i3 clone)
Cura 3.2

This was fixed in v3.2 of the plugin. Please download the latest one. Which firmware does the Touch have? RepRap? Because it seems that you have selected RepRap for your gcode flavor in Cura.

Actually, looks like there may be another bug in Cura. Can you post your settings? This doesn't make any sense:

G1 X96.839 Y92.381 E0.00625
G1 F1500 E-6.5
G0 F3000 X97.614 Y93.114
G0 X102.33 Y106.83
G0 X102.8 Y107.3
G1 F1500 E6.5
G1 F1800 X97.2 Y107.3 E0.27939

Extruder distance goes from E6.5 to E0.27939. Why? Seems like it's priming right in the middle.

I am using the latest version of your plugin, as shown in the attached screen grab.

Machine Settings and Extruder Settings attached.
Note: The setup documentation included in print and online for this printer is abysmal for any in-depth info. They did include a Cocoon branded Cura install, with no version number or About section I'm assuming it's 15.04. Cura 3.2 doesn't have a Machine profile in Add Printer, so i made a custom machine and transposed the settings presented in the included Cocoon branded install. Looks like it uses RepRap Gcode flavor. I also transposed the start/end gcode, listed below:

Start gcode:
;Sliced at: {day} {date} {time}
;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
;Print time: {print_time}
;Filament used: {filament_amount}m {filament_weight}g
;Filament cost: {filament_cost}
;M190 S{print_bed_temperature} ;Uncomment to add your own bed temperature line
;M109 S{print_temperature} ;Uncomment to add your own temperature line
G21        ;metric values
G90        ;absolute positioning
M82        ;set extruder to absolute mode
M107       ;start with the fan off

G28 X0 Y0  ;move X/Y to min endstops
G28 Z0     ;move Z to min endstops

G1 Z15.0 F{travel_speed} ;move the platform down 15mm

G92 E0                  ;zero the extruded length
G1 F140 E30              ;extrude 3mm of feed stock
G1 X20 Y0 F140 E30
G92 E0                  ;zero the extruded length again
G1 F{travel_speed}
;Put printing message on LCD screen
M117 Printing...
End Gcode:
;End GCode
M104 S0                     ;extruder heater off
M140 S0                     ;heated bed heater off (if you have it)

G91                                    ;relative positioning
G1 E-1 F300                            ;retract the filament a bit before lifting the nozzle, to release some of the pressure
G1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more
G28 X0 Y0
G1 Z160                                 ;move X/Y to min endstops, so the head is out of the way
M84                         ;steppers off
G90                         ;absolute positioning

Lastly, this is my first printer, so please excuse any ignorance on my part. Thanks for your help.

Please change your gcode flavor to "Marlin" and try again.

I'm happy that worked, but embarrassed it was so simple.

I can at least confirm for you that your plugin does work with the HE161192 - Cocoon Create Touchscreen 3D Printer, when using Marlin gcode flavor in Cura 3.2.

Thanks again for this great plugin, and your support.

CR-10 is a Bowden setup. You probably want to reduce the reraction.

Seems like the default retraction is too high for your printer. Please try lowering the retraction and extrusion distance and let me know if it works for you. You can every try values of zero to turn it off.

I tried it again the other day, but didn't change anything, I just sliced it again with the same Layer where he should stop and this time it worked perfectly fine (just like your description), but I dont know why :D

I was going to upload a remix of this since I had assumed that work on this had stopped, but I come back and there's a version 3.0 now!! Amazing!

If I may add a suggestion, I noticed that sometimes my print head isn't locked, and I'm able to shift the X axis when changing the filament. This of course would be fatal to the print if I didn't do a "G28 X Y" command to rehome the X and Y axis.

After we resume the print, can we make this an option to add this as part of the static gcode that gets inserted into the file? That way we can ensure the printer has a proper starting point after every filament change regardless if the motors were able to lock (and didn't unlock due to marlin timeout).

Version 3.x of the plugin locks the stepper motors at each step. The previous version didn't. Please read the details page. The "summary" gives you a very short summary of what it does.

My theory (and I could be wrong), is that you want to avoid homing because homing is not exact. You might be forced to do it if you lose power, but if you can avoid it, you should. The end stops are mechanical switches and have some variance. Variances in the Z axis would have little noticeable effect, but even a fraction of a millimeter in the X or Y axis, and you'll have visible lines. This is based on my experience of doing the same thing. I'd accidentally move the head while I'm changing filament or inserting something, so I rehome. I sometimes saw a layer shift in the X or Y axis.

Since I added the feature to lock the stepper motors at each step, I've had zero issues. I've printed a LOT of these:

I'm not against adding the feature to rehome before it resumes though, if you think that others will have better luck. I'd make it an option that would be off by default though. Please let me know what you think.

Magnetic Construction Toys

Hi, did anyone try to let this plugin work with Anycubic I3 Mega? I tried to do it but the extruder went in the correct x,y,z position and stop working, but on the screen I saw only Pause or Print, this mean that it wasn't in "pause". I took out the PLA and put in the new one, on the screen appeared "print" or "resume". I pressed on "resume" but nothing appened. I press it other 10 or 15 times, but nothing.... Please help me... I only want to do multiple colour print...

Maybe it doesn't work for your printer. However, the second time you resume, it has to heat up the printer, so there is no immediate feedback.

I set stanby temperature to the same printing temperature, in order to change the filament easyer... so, no adding time to heat up the printer...

Sorry! This is fixed in v3.1.

If you're using dual extruders and a stand by temperature, then just turn off the "Cool extruder on pause" option in the plugin dialog. The plugin is not aware of multiple extruders.

No no, I'm using a printer with only one extruder, anycubic i3 mega... so i have to wait the 3.1 version? Please help me........ thanks!

Version 3.1 is available. It's already updated. Just redownload and reinstall.

I've just tried.... It doesn't work... The printer stops working but doesn't switch to pause, so it is impossible to press "resume"...........

Are you using v3.1 of the Change Height plugin?

You are talking about cura 3.1??? Because I have the latest version, I've installed it a few days ago, when my printer arrived...

No. v3.1 of the Change Height plugin fixes the issue.

aaahhhh, sorry..... How could I check the version of the plugin?

I download the new one and replace it, but I think it was 3.1 also before. I'll try to print again now...

The version shows as part of the name when you choose the plugin in Cura.

This is the situation after the printing reach the "5" level setted:
It stops extruding
temperature go to "0"
axis x y z to settings point
but no "pause mode"

I put the pause at height file into the script folder, and stop, it's correct? I have also to do other things?
Let me know.... thank you very much

Please read the full description. It has complete instructions for installation and usage.

I've done. It doesn't work. I think the problem is that m25 command in gcode stops working the printer, but doesn't put the printer on "pause" mode. Anycubic i3 Mega gives you the possibility to pause your print and resume just clicking the "pause" bottom on the touch screen during printing. Probably this plugin dosn't work at the same way, so the printer doesn't recognize the "pause". The result is that the printer execute all the operation untill M25 command, but then it stops without going in "pause" mode. Infact on the display the printing time goes up, like the printing it's going on,but nothing happen . You have to turn the printer off and restart it.
Probably to solve the problem you could try to change a command pause to a temporal pause, like 1 minute or more, you could let everyone choose by the plugin settings in cura... It's an idea... Is it possible?
Another thing...
m117 doesn't display anything on the screen
I hope I managed to explain myself, sorry for my bad English

Sorry, I have 3.0, I see only the beta version 3.1, it's ok? thanks

Hi, when i click the first "continue print" the nozzle goes to the corner and cool down (as it should), but when i press the second "continue print" nothing happen- it look like the nozle doesnt get command to heat up, nothing happend no matter how much i click the "continue print" button. i use wanhao duplicator i3 plus

Sorry! This is fixed in v3.1.

I just had this same thing happen on a maker select v2. after locking the stepper motors, pressing the button again should have gone to heating mode but the extruder never heated up. I couldn't do anything so I tried "pause print" and it locked up for a while.

Here's the relevant GCode:

;added code by post processing
;script: ChangeAtHeight.py
;current z: 1.220000
M83  ;Set extruder to relative mode
G1 E-5.000000 F2400  ;Retract
G1 X10.000000 Y10.000000 Z25.000000 F3000   ;Move head away
M104 S0  ;Turn off extruder heat
M117 Press Continue...
M300  ;Beep
M25  ;Pause
G91  ;Set to relative position mode
G1 X-0.1 Y-0.1 Z-0.1  ; Lock motors
G1 X0.1 Y0.1 Z0.1  ; Lock motors
G90  ;Set back to absolute position mode
M117 Press Continue...
M300  ;Beep
M25  ;Pause
G91  ;Set to relative position mode
G1 X-0.1 Y-0.1 Z-0.1  ; Lock motors
G1 X0.1 Y0.1 Z0.1  ; Lock motors
G90  ;Set back to absolute position mode
M117 Heating extruder...
M109 S0.000000  ;Heat extruder back up for filament change (wait)
M117 Press Continue...
M300  ;Beep
M25  ;Pause
G91  ;Set to relative position mode
G1 X-0.1 Y-0.1 Z-0.1  ; Lock motors
G1 X0.1 Y0.1 Z0.1  ; Lock motors
G90  ;Set back to absolute position mode
;Prime nozzle
G1 E6.000000 F6000
G1 E-5.000000 F6000
M117 Press Continue...
M300  ;Beep
M25  ;Pause
G1 E-5.000000 F2400 ;Retract
G1 X80.557000 Y87.951000 Z1.220000 F3000  ;Move to next layer position
G1 E5.000000 F2400 ;Extrude
M82  ;Set extruder back to absolute mode
G92  E842.973900  ;Set the extrude value to the previous (before last retraction)
M117 Printing...
;CUSTOM Pause Done

I'm guessing that you have your Printing Temperature set to 0 in Cura and are preheating the printer at the control box. You need to use the Printing Temperature in Cura because that is the temperature that the plugin uses. Since you have it set to 0, that is what the plugin sets the temp to. If you don't think that's the case, please include the entire GCode, or at least the lines where it sets the temp in the GCode (the M104 and M109 lines). Thank you.

Actually.... looking at it now, here's the bug no?

M109 S0.000000  ;Heat extruder back up for filament change (wait)

That's never going to happen... My gcode starts with:

;Filament used: 0.904792m
;Layer height: 0.1
;Generated with Cura_SteamEngine 3.0.4
M190 S60
M104 S195
M109 S195
M82 ; absolute extrusion mode
G21 ;metric values
G90 ;absolute positioning
M82 ;set extruder to absolute mode
M107 ;start with the fan off
G28 X0 Y0 ;move X/Y to min endstops
G28 Z0 ;move Z to min endstops
G1 Z15.0 F9000 ;move the platform down 15mm
G92 E0 ;zero the extruded length
G1 F200 E3 ;extrude 3mm of feed stock
G92 E0 ;zero the extruded length again
G1 F9000
;Put printing message on LCD screen
M117 Printing...

there's no other M104/109 before the CUSTOM block

Looking at your code, here's my question... is it possible it's getting using its own gcode output from a previous run? The most recent M104/M109 is going to be inside this CUSTOM block so it's possible that's getting used. I see the currently_in_custom part but perhaps there's a bug in there.

Do you have a GitHub repo for this? We can discuss there (although here is ok too if not).

Thank you. I found the bug! The bug is that it's not getting the extruder temp before layer 0. I guess that I had been getting lucky because Cura had been adding another M104 after the first layer, however, if you don't have the extruder temps in your start GCode, that doesn't happen for some reason.

This is fixed in v3.1. Thank you!

Excellent! Yeah, I was looking through the code last night briefly and was thinking it had something to do with those continue statements jumping past it.

Thanks for the quick fix. I'll give this one a go.

I definitely have the temperature set in Cura. I seldom preheat the bed and usually just hit print and let the gcode do it. I’ll pull out the temperature commands for you when I get back to my laptop.

I have to "resume" a 3rd time then it starts. I'm doing it from octoprint so it may be a little different but I wouldn't think so.

Same. Third time's a charm. Thanks for posting this. I was getting ready to trash my print.

One more thing, feel near the nozzle to see if it heated up and your printer just isn't reading the temp. Maybe you bumped one of the wires to the thermistor. Or, possibly, if it's not heated up, maybe you bumped one of the wires to the heater core while you were changing filament? Make sure that your printer does still heat up.

On second thought. Has GCODE ever worked to heat your extruder to temp? I know that some people typically use the preheat option in the menu because GCODE doesn't heat their extruder. If this is the case, you may just have to preheat the nozzle at the menu and hopefully the plugin will resume when it reaches temp.

Sorry. Could be a bug. Can you send your Gcode file to me to take a look at? It's supposed to go back to the last temperature

Awesome update @rawlogic, thanks! I've used the plugin a number of times lately. Stoked to be able to just a layer number now.

I tried to have it pause at a layer and it would move to the designed position, but it wouldn't pause it would just right back to printing. What needs to be changed to get it to pause. I'm using a Anet A8 with cura 3.0.4

Never mind I had just installed the v1 instead of the v2. But is there a way in increase the time the stepper motors are on

Works great, when you can get it working.

I'm running Cura 3.0.4 AppImage on Ubuntu 16.04. I found that I had to launch Cura, then find where it extracts everything to (AppImage extracts to /tmp/.mount_/usr/bin/*), copy the PostProcessingPlugin directory to ~/.local/share/cura/3.0/plugins/MyPostProcessingPlugin, rename and edit the PostProcessingPlugin.py (change to MyPostProcessingPlugin), then restart Cura for it to show up and not get clobbered by the original script.

Cura 3.1 'may' fix this issue. Would be nice (rather have an installer for Linux, but will take what I can get).

Fantastic idea! I really want to print raised letter things in different colors.

Any possibility of a Cura V3 flavor of the plugin?

The Cura 2.x version also seems to work with Cura 3.x.

By the way, you are a friggen hero for posting this. I have been trying to figure out how to do this for months.....

In case anyone is wondering, this works using Octoprint as well..You dont have to print directly from an SD card. It pauses, moves, you change the filament, and click resume print on the Octoprint screen and off you go.

I have to hit resume 3-4 times. Anyone else have this problem?

Which printer/firmware?

Anet A8 skynet.

Okay, so it's probably normal. Read the details page to learn what each step is doing.

I had to look at GCode to see what it is doing. It appears to be by design, but is repeating itself:
;added code by post processing
;script: ChangeAtHeight.py
;current z: 0.500000
M83 ;Set extruder to relative mode
G1 E-5.000000 F2400 ;Retract
G1 X10.000000 Y10.000000 Z25.000000 F3000 ;Move head away
M104 S0 ;Turn off extruder heat
M117 Press Continue...
M300 ;Beep
M25 ;Pause
G91 ;Set to relative position mode
G1 X-0.1 Y-0.1 Z-0.1 ; Lock motors
G1 X0.1 Y0.1 Z0.1 ; Lock motors
G90 ;Set back to absolute position mode
M117 Press Continue...
M300 ;Beep
M25 ;Pause
G91 ;Set to relative position mode
G1 X-0.1 Y-0.1 Z-0.1 ; Lock motors
G1 X0.1 Y0.1 Z0.1 ; Lock motors
G90 ;Set back to absolute position mode
M117 Heating extruder...
M109 S190.000000 ;Heat extruder back up for filament change (wait)
M117 Press Continue...
M300 ;Beep
M25 ;Pause
G91 ;Set to relative position mode
G1 X-0.1 Y-0.1 Z-0.1 ; Lock motors
G1 X0.1 Y0.1 Z0.1 ; Lock motors
G90 ;Set back to absolute position mode
;Prime nozzle
G1 E6.000000 F6000
G1 E-5.000000 F6000
M117 Press Continue...
M300 ;Beep
M25 ;Pause
G1 E-5.000000 F2400 ;Retract
G1 X79.985000 Y106.099000 Z0.500000 F3000 ;Move to next layer position
G1 E5.000000 F2400 ;Extrude
M82 ;Set extruder back to absolute mode
G92 E23.710640 ;Set the extrude value to the previous (before last retraction)
M117 Printing...

I have an Anet A8 using Cura 15 and this plugin worked BEAUTIFULLY! thank you so much!

im using cura 2.7 and im struggling to find this pluginh i am very new i followed your guide and printer im using is creality cr-10

If you have the plugin installed in the correct folder and have restarted Cura, you will find it in the Cura program via:
Extensions->Post Processing->Modify G-Code->Add a script

Thanks for figuring out the change filament! I was able to finally get some solid results for multi-level color changes. I attached a picture of a small test piece i made before going to the big stuff!

What is the difference between the two plug in files?

changeAtZ.py is for Cura 15.x.
ChangeAtHeight.py is for Cura 2.x.

It works with Geeetech MeCreator 2.

I would like to have option to disable beep and change minimum Z lift from 50mm to 10mm or even 0. I can hear when printer is printing, so loud beep is unnecessary but annoying. Z height of printers is slow and I know I can easily change filament with only 10mm distance from print bed.

Great ideas. I think I'll change the default to 25mm anyway. 50mm is too high. I was getting ready to release v3.0, but I'll add these features first.

Has anyone had any luck on the Ultimaker 3? I've been getting this error: C:\Users\tcebula\appdata\roaming\cura\2.6\plugins\changeatheight: Invalid plugin file.

That doesn't seem like the right place to put the file. The instructions say to put the file in the C:\Program Files\Cura 2.3\plugins\PostProcessingPlugin\scripts folder.

I have 2.7 but I got it working. Thank you very much.


I had some issues getting it working. It was mostly confusion on the method, on the Wanhao/Monoprice end. You should really put in the Thing's description:

-When it stops, don't move the print head, hit "Continue Print" once to lock the motors.
-Change the filament, either manually or with control box.
-Click "Continue Print" to resume print.

This wasn't clear to me in the instructions, so I had a lot of failed prints and trial and error before finally figuring out that hitting Continue Print once would lock motors, and then again to resume. Until then, I hope this helps out others who might have some problems with the motors not being locked.

Thank you for creating this, it works amazing and is a big help on my projects!

I feel like this issue only affects Cura 2 and up, I don't think it's present on Cura 15
, but i cant be sure and I'm not sure why.... I can't find the bug, buyt thank you for a solution!!

Having some issues with the axis not being locked?
What can I change in the .py file to make this not disengage the motors or is that a function of firmware that is doing this? Last attempt the left side of the Z axis moved down I can see it shift in the lime lapse footage and after 6 hours that print was failed.

Can the axis be moved safely using OctoPrint controls while in pause and still return to proper resume positions automaticly? This would re-lock the motors before a filament change if it is firmware timeout unlocking them.


Used it today for my first 2 color print works like a charm. Monoselect Maker Select v2.1

Thank you!

Nice time lapse video. Thanks for sharing!

hi.i tried with anet a8 + skynet firmware
but it seems the stepper dont lock at all..do u know why this happen?
first try the z axis goes down.2nd try, the x axis messed up

Great script here. I'd had problems in the past with "Pause at height" because the steppers weren't locked, so the print head would invariably shift a tad while I changed the filaments. This script gets it right. Thanks!

I just uploaded a tutorial on using this plugin:

Comments deleted.

I don't know if its possible, but can you add something to change filament at the layer number instead of millimeters? Cause that will save a lot of work. I always look at the layer view to see which layer I want to change filament and have to make the following calculation "(layer height-1)*0.2+0.16". It would also be great if you can something like a checkbox to use just M600 instead of al the separate commands.

The usual problem would be that not everybody uses the same layer height, making the program much to complicated I would assume.

Thanks rawlogic. In the latest version, the retraction and subsequent extrusion you have in the code is 7mm. Possible in the next version to move that up to the settings?

Your wish is my command. Version 2.0 has moved all of the retraction settings to parameters! :)

It works on the anet a8! ( Prusa i3 clone )

I'm using Cura 2.5 on Ubuntu.
Can't get the plugin to show up in Cura. Tried to place it in both "/usr/lib/cura/plugins/" as well as in "~/.cura/plugins/".
Restarted Cura.
Doesn't show up under the "Extensions" menu or in "Plugins" tab in "Configure Cura".
Am I missing something here? Anyone else got it to work on Linux?

The correct folder for Ubuntu is:

In case anyone else has the same issue.

I'm using cura beta on my ubuntu, but i don't seem to have the PostProcessingPlugging folder ...

Help would be appreciated

First of all: Are you sure it doesn't exist? How did you check?
Secon suggestion: Try creating the missing folder (command "sudo mkdir" in terminal)
If it still doesn't work: Why not install the latest version of Cura? (You didn't say what version you have currently, but since you say it's a beta then maybe its outdated)

Has anyone got this to work on a mac. I have tried putting it in multiple dir's inside cura but can't see it in the app.

I don't know if you have figured it out but you can do the following:

  1. Select Extensions -> Post Processing -> Modify G-Code
  2. Select Add Script drop down list button and select the Change Filament at Height v1.3. This will add the post processing button next to the Save to Removable Drive button

The Pause at height plugin that comes with Cura (at least 2.6) has a "Redo Layers" option that makes it repeat one or more layers with the new filament to get better adhesion.

Any chance of implementing that?

The main reason I want it is that my printer doesn't extrude for the first couple cm after the print restarts, leaving a little gap in the print. If it redid the first layer, it would make a stronger bond between the layers and leave no gaps.

Does anybody know or have used if this works with bowden printers without getting filament stuck in the PTFE tube? I am afraid when it will retract the hot filament may get stuck in the tube, or it may leave some residue in the tube that may result in clogging it.

You should probably not use this with a bowden tube unless you have good luck with retraction. There is quite a bit of retraction (7 mm).

I tried it several times and it works great. After it stops, I just pull out the filament quickly through the tube and nothing goes wrong, and then feed the new filament in. Because of this I have the precise control over changing the filament color mid print. Before I used to cut out the current filament at the extruder (which is about half a meter of tube away from the hot end) while it would be printing, and then feed the new filament into the extruder and it would have to use up all the old filament still in the tube before it would change color. Now I can precisely change the color at a particular height. Perfect. Thank you.

I tried it, but it isn't working with my Repetier delta printer. I see there is a change at height and a change at height for Repetier. I guess I have to have the repetier option, but that isn't configured with your file.

Can someone help how do to get "changeAtZ.py" plugin

Comments deleted.

I guess this does not work with the Monoprice Maker Select Ultimate? Mine pauses at the right height and moves to front left put there is no "change filament" on the screen and nothing to resume. Printer goes to cooling stage after the pause and so wasted prints :( Any workaround for this one? Seems it should be the same as the reg. Select.

Sorry. It appears that the MP Maker Select Ultimate is an Ultimaker clone. The Ultimaker uses a custom Marlin firmware. I'll see if I can find a copy of the firmware online and try to update the plug in when I get a chance if you're willing to test it out for me. :)

Of course I will! :) Thank you

It looks like the Ultimaker Marlin firmware supports all of the necessary commands. It's stated at the bottom under "Important", but, the Change Filament plug in only works when printing from the SD card, not when printing from the computer (via the USB cable). Are you printing from the SD card?

yes SD card and it definitely does NOT work. It will pause and move to correct place but there is no resume print ever. Tried the change material and if you go back to print there is no Resume only to restart the print from the beginning.

Don't know if you ever figured this out, but you have to go into the SD Card option on the printer and tell it to continue print. For some reason, I have to do that twice every time, but it works for me.

This script is awesome! My only issue is when changing the filament if I push too hard the extruder can move up or down, that stepper isn't engaged/locked. Any way to lock that?

It stays locked for me. The script doesn't disengage the motors. However, you might have a "Stepper Inactive" set in your firmware. My firmware defaulted to 360. That's the number of seconds that the motors automatically disable after being idle. So, if I take more than 6 minutes to switch the filaments, the steppers will automatically disable. You can increase this time in your firmware (available from the Configuration menu on the controller on my printer), or stay attentive and change the filament quickly.

Thanks for the reply. I want to say I did it instantly, but I can't with 100% certainty. I'm printing some coasters now that have 5 changes in them and on the 2nd to last one and all has worked well so far. Thanks a ton for writing this plugin!

Will this work with OctoPrint or do I have to print from the SD card?

Seems to have worked fine with my Octoprint setup with a Maker Select. I had to hit resume twice after changing the filament but it resumed perfectly. Finding this really useful, so I am glad it works with my setup.

tried it with renkforce rf100, after resumed the percent counts to 100% and finish print. but not with the second filament

This worked perfectly for me. On my Monoprice Maker Select, it parks the head at the home position well above the bed. I then MANUALLY pull the filament and load MANUALLY the new filament. On loading, give the new filament a little time to reach melting temperature, then hold the clamp on the extruder head and advance the filament until the color change is complete. Hit "continue" and it resumes where it left off. DO NOT leave the "print" screen, don't attempt to use the unload and load filament functions under the tools menu. REMAIN in PRINT the entire time. I'm making replacement draw knobs for a pipe organ and wanted a white face label with black background. Works perfectly! Salamat po.

Thank you so much for making this available! We have a dual extruder printer as well, but couldn't get a color change at a certain layer to produce a good print, instead leaving blobs of the other color all over the place. With this plugin we could print on our Airwolf3D Axiom and change color at a certain height, allowing us to create a 3D printed business logo in two color without a whole lot of ugliness especially doing a light background with dark text.

Thanks Rawlogic!

Awesome to hear. Thanks for the feedback.

Does it work with (Wanhao version) Cura, I've put the plugin in the plugins folder, it doesn't show up when I restart Cura,

Yes. it works for Wanhao versions. In the Expert menu, you'll need to "Switch to full settings" to see the plugins. Also, make sure you restart Cura after dropping the plugin in the folder. Make sure you use the "changeAtZ.py" file, which will work with both Cura 15 and their specially branded Cura 16.

I tired this today with my MonoPrice Mini Select, and while it paused beautifully, there was no way to to resume
All I had the ability to control was
extruder temp.
bed temp
speed multiple
Pause/Resume - which homed the print head, and then returned it to the same location - but did not resume printing

Any thoughts?

To resume, it's under SD Card. Continue Print.

but there's no way to get out of the print display (I'm running 24.42 if that happens to matter) the only way to get out of the "actively printing.gcode" screen is to cancel the print

Sorry, I didn't realize earlier that you are using the "Mini" Select. On the "Maker" Select, to get out of the display, you just press the button on the knob on the control box. Are you able to pause the print while it's printing, then resume it? On the Maker Select, you can. I suppose the "Mini" select uses a different firmware and may not be supported. I'll remove it from the list of possible supported printers. Please let me know if you figure anything out further.

Figured out a workaround... after connecting my printer to wifi, I am able to send an M24 command to resume using repetier-host

Hi! Can you elaborate on how you solved this issue? I just got my MonoPrice Mini Select V2 about a week as my very first 3D printer so I'm quite inexperienced. I ran into the same problem you did where it would pause just how I want it to but there's no resume option on the control panel. Thanks!

cheers man.. im gonna try that ;) whats the most amount of time you can have during the pause .. to change filament ??

thank you

Thanks for this trick!!! I'm doing the same now in a MALYAN M200, printing by SDCard with repetier host connected to the printer by USB. When the print is paused I can change filament and send M24 command to resume.

That's so cool. It's too bad that you can't resume it via the control box.

Tried this with my Prusa i3 today using Cura 15.04.6 and it worked great. Thank you.

Interesting. Any idea if this will work with the current version of Cura (2.3.1)?

There is now a Cura 2 version of the plugin available.

Comments deleted.