Report as inappropriate

First off, thanks for the background work in creating this much needed resource.

This may be obvious, but, I do not print using the LCD or SDCARD, I use a dedicated notebook running Win10 and the USB connection. Will this script work the same way when printing from a PC? I am running a FLSUN CUBE printer, updated to 32 bit with Marlin 2.x and use Simplify3D for slicing, and for the printing as well.

When using this scripting solution, does the location that the script moves the hot end to (x, y and z location) get saved by the printer, and as long as I only use the PC(in my case) to move the hot end for ease of access to catch flushed out previous colour filament using the Jog Control/Extrude button in Simplify3D, and all I would need to do is press Resume? Or would I need to use the Jog Controls to put the hotend back to where it was placed by the script before pressing Resume?

----Edit to add update

After reading through this thread and some others, and then looking at the GCODE file itself, it looks like when you use the M0 command to pause the print, it will stop processing the GCODE file at that point. Since the next pre-existing lines have the x, y and z co-ordinates in them, it must automatically return to where it needs to start again, regardless of any moves you make. The script you have provided includes M117 which is not used when you are using the PC to print via the USB. Given that, here is what I think I need to put in the post-processing box to pause my print job at layer 150 and 300 to change filament, are they correct? Do I need the new line (/n) in there?

{REPLACE " Z = " " Z="}
{REPLACE "\nLayer 150, Z=" "\nG1 X10 Y5\nM300\nM0\Layer 150, Z="}
{REPLACE "\nLayer 300, Z=" "\nG1 X10 Y5\nM300\nM0\nLayer 300, Z="}

---- Edit to add results

I ended up revising the script suggestion to just this when printing from Simplify3D on a PC via USB to printer..

{REPLACE " Z = " " Z="}
{REPLACE "; layer 150, Z=" "G1 X10 Y5\nM0\n; layer 150, Z="}
{REPLACE "; layer 300, Z=" "G1 X10 Y5\nM0\n; layer 300, Z="}

You don't really need the first line, provided you know for sure what the format of the ; layer line is in your GCODE file. I left it in purely to make it easier for me at the time. Since you are not using the LCD, the formatting of the line to allow it to fit is not really necessary. The inclusion of the semi-colons are there to avoid creating an issue with comments. The \n is a line feed(or next line) and puts each command on its own line. The script keeps the value of Z in the GCODE file, and inserts the new commands ahead of that number so that the final Z= get prepended to that value. After clicking resume, the machine goes to the location specified in the GCODE file, regardless of where you left the hotend. I would suggest that you locate a good location on your particular machine where you have the necessary room to change the filament. I would also suggest you not use the Jog Controls tab to move the filament or to flush out the old colour. I did that the first time, and as soon as the hotend was returned to the correct location to print, it retracted 100mm of filament, then proceeded to print. I saw it happen, so I hit pause, then manually pushed the 100mm of filament back in until I felt it hit the melted stuff. At the next change I did it manually. It is also quite easy to push the filament through manually to flush. I stick a sheet of paper under the nozzle to catch the mass.