Filament Change GCODE for QIDI Tech 1 2018


I have a successful setup of Octoprint connected to my QIDI Tech 1 (2018) model via Raspberry Pi 3+ I have the awesome "Enclosure Plugin" installed and setup with: added relays to turn the printer on and off, turn the LEDS on and off, Temp Sensors to measure ambient and enclosure temps, a heater to warm the cabinet when needed (ABS) and two filament sensors to detect breaks and empty spools. They work in the sense Octoprint pauses when the filament runs out.

This is where I need help. By default, there are no "After print job is paused" or "Before Print Job Is Resumed" GCODE's Only the "After Print Job is Cancelled" Scripts. I have scoured the internet and forums and have yet to find a GCODE script that works. The printer ends up either air printing above the test job or crashes into the build plate. Below are the current codes I am trying to make work. They almost work but just crash into the print job. I'm not that great with GCODES yet and am hoping there is a GCODE wizard out there that might know the QIDI Tech 1 printer (sailfish 7.8) and how to make it pause so the filament can be changed and then start back up properly. This is my first post to the forum so please correct me if I"m going about getting help wrong or am not in the correct area for this help. Thanks in advance!

M83 ; relative extruder moves
G1 E-5 F3600 ; retract 5mm of filament
G91 ; relative positioning
G1 Z5 F360 ; lift Z by 5mm
G90 ; absolute positioning
G1 X0 Y0 F6000 ; go to X=0 Y=0

Resume GCODE:
M83 ; relative extruder moves
G1 E5 F3600 ; extrude 5mm of filament
M82 ;set extruder to absolute mode
G91 ; relative positioning
G1 Z-5 F360 ; lower Z by 5mm
G90; set to absolute positioning


Anyone? Is my post asking the wrong questions, or supplying incomplete information to get help? I'd be happy to gather anything needed do a test, etc. A related question is: when my filament sensor pauses the printer through octoprint, what codes are being sent to the printer, then being translated through GPX?

Thanks, In advance!


Hi @Kelly!

When you pause the print for filament change, you move the head to {0/0}.
When you resume, you have to tell the printer where to resume.
Have a look at listings 4 and 5 of this doc file.


Ewald, thanks for the reply. I had already studied those scripts but I have a dual extruder printer and the doc says not to use them with a dual extruder printer. Tonight, I did some tests. First, remember I'm using the OctoPrint Enclosure Plugin. I have two fliament sensors tied to the raspberry. Either one will trigger a pause if I remove the filament. For each filament sensor setup there is an option for "Filament Change" which is what I'm using. Under the advanced settings is this GCODE script for filament change:
G91 ;Set Relative Mode
G1 E-5.000000 F500 ;Retract 5mm
G1 Z15 F300 ;move Z up 15mm
G90 ;Set Absolute Mode
G1 X20 Y20 F9000 ;Move to hold position
G91 ;Set Relative Mode
G1 E-40 F500 ;Retract 40mm
M0 ;Idle Hold
G90 ;Set Absolute Mode
G1 F5000 ;Set speed limits
G28 X0 Y0 ;Home X Y
M82 ;Set extruder to Absolute Mode
G92 E0 ;Set Extruder to 0
So for my test, I removed my pause and resume GCODES under Octoprint's GCODEscripts and did a test print. As soon as I open the filament sensor the printer pauses, raises, reverses the filament from the extruder and moves over to home position. I close the filament sensor and the printer moves back to position and started printing again. since I didn't load another filament it was just printing air but it seemed to work. I'll be testing some more in the next few evening and report back. Seems like it should stay paused until I initiate a resume but overall I'm a bit closer.