Hello, I found the following code on youtube. It is to allow for changing the filament color at a selected layer. It seems to work for the most part except the first thing it does is raise the Z height by 5 cm and when it comes back to print the Z height does not come back down to the original height. Also it doesn't currently pause to give time to change the filament but I will add a G4 with time to get that done. I don't see where it is raising Z height. I am using the Anet A8 factory file as is with just some basic mods like speed and layer height, ect. I did see in the firmware tab there is code in Macro 1 with a line saying G1 something that will raise the Z height by 5 cm. Is this getting called? I'm not sure about this Macro business yet. Any help would be appreciated.

I know its been a while but I am getting back to this now. This code works except for the pause. It does everything but pause. My machine is stock A8 firmware and must not recognize M0. If it did what do you click to restart? I have googled and tried every G and M code for pause I found. I thought for sure using G4 with time would do the trick but it did not. Thanks

Thanks for your reply. I have already tried M226 and it does not work. I have also read the wiki's. I have saved gcode to SD card and edited the G4 dwell at the layer and it works running from SD card. I want to use USB and the G4 dwell does not work in the post process window.

Hi,
your question was theme in the german reprap-forum yesterday, but I didn't refind the thread.

Marlin does not know the first variant of my link above, but Repetierfirmware does it.
Using Marlin the 2nd variant of the link is available. The author in the forum wrote, Marlin & M226 without parameters (no signal to any pin) waits to the push button because press down the button create the required signal itself.

The macro 1 I'm understanding only as an example how a macro works, it seems that it doesn't have a deeper sense than lift the nozzle 50 mm. Running macros is only possible for a manually starting by cklicking the Macro-Button in the Control Center and not for automatical actions.

Your link in the first posting
{REPLACE "\n; layer 7, Z = " "; layer 7\nG28 Y0 X0\nM300\nM25\nM17\nG92 E0\nG28 Y0 X0\nG92 E0\nG1 F200 E25\nG92 E0\n; layer 7 "}
extrude only 25 mm filament after a movement to X0Y0, it is easy to supplement the code (also as the Macros) but the used M25 is only useable in the SD-card-mode. It doesn't prepare the filament change itself but on a Anet A 8 there is asked real manpower to do it, also it is sufficient to move the printhead beside to X0Y0. Changing the filament is only manually pulling back the first one and replaced by the 2nd one also as bringing it forward to extrusion the new color.

Thanks for reply, I have been checking RepRap forum for replies to my post but none there so far. http://forums.reprap.org/read.php?406,818355
Here is what I have come up with so far. I have been running test prints with no filament using this in the post process window:

This works.......sometimes. I determined by testing different M and G codes for pause that the buffer is causing issues. The G4 would work but always after the head moved over and came back to resume the print then it would pause for the dwell time after the buffer was clear. (Strangely only P dwell seems to work not S dwell).
M400 makes it pause where I want it to, gives me three minutes to do a manual filament change and then it resumes the print after the dwell time. Here is the funny part. Sometimes is resumes and completes the print, sometimes it resumes for a short time and then starts doing crazy things like moving over to the edge of the bed and then coming back. One time is seemed as though it completely started the print all over again by moving the head down to first layer height and running the start G-code. I know this cause it did a nozzle wipe which is only in the start G-code. This weekend I'm going to save my G-code to SD and edit the line above at the correct layer start and see what happens.