# Any code to move up Z axis after finishing the printing?

Is the firts time that I saw this movement after the printing has finishig and causes the nozzle crashes to the printed part and I noticed due the part is 14x8 and the nozzle is to near and below to the border of the shape. I supposed that some scripts has changed but, seems to be everything ok.

this is the end script:

G92 E0
G1 E-1.5000 F1800
; layer end
M104 S0 ; turn off extruder
M140 S0 ; turn off bed
G28 X0  ; home X axis
M84 ; disable motors
; Build Summary
;   Build time: 3 hours 9 minutes
;   Filament length: 12689.1 mm (12.69 m)
;   Plastic volume: 30520.78 mm^3 (30.52 cc)
;   Plastic weight: 38.15 g (0.08 lb)


Z axis moves down 4mm after finishing going to X0, why? I don't want the nozzle crashes the part on going to zero.

You can use:

G91
G1 Z10


G91 make the printer use ralative positioning, while G1 Z10 would move the gantry up of 10mm, reagrdless of its actual position.

In order to understand what's going on, you could experiment with the position of those lines in the script.

The safest bet it to insert them at the very top, but you could insert them straight after the homing of the X axis to understand if the drop you are seeing is caused by the homing command itself or by the ´M84´ one.

My guess is that the drop is actually caused by the latter. M84 doesn't really "disable motors", rather it stops using energy to keep them still (i.e.: it stops the idle hold). What I believe is happening in your case is that when you stop the idle hold, the weight and mechanical play of the X gantry causes it to move slightly (a bit like when you relax your body on the sofa and you "sink" in it a bit more).

• This is actually very dangerous if you print at the max Z height, you then would not have the extra 10 mm.
– 0scar
Jul 17, 2019 at 17:13
• Care to elaborate? The worst thing that I can think can happen is that the stepper motor will skip a few steps. Not a big deal...
– mac
Jul 18, 2019 at 21:17
• E.g. acrylic frame printers are less sturdy, steppers are powerful and do not skip, I've seen this happen on my first printer.
– 0scar
Jul 19, 2019 at 5:27

There is something fundamentally wrong with your z-motor drive if both screws are dropping the gantry at all.

Try a couple experiments.
Write a quick script to move the head somewhere up high, then terminate without the X-homing command. See if the z-axis moves. Ditto for X-home but not motor disable.

Write any script, and while the gantry is up high, pull power and see what happens.

That will at least help narrow down the list of possible problems. In the meantime, please post your printer, the motors, and the driver board/firmware in use.

• "There is something fundamentally wrong with your z-motor drive if both screws are dropping the gantry at all" - Only if this was happening with idle hold ON. Without it, it may just be the sign of a nearly frictionless Z-axis mechanical system. Just to name a printer with such a build: the Cetus, with a common problem on their first batch being that on power-off the nozzle would come down crashing on the building plate (see youtu.be/D_i3vAV7EJ4?t=42s).
– mac
Feb 22, 2018 at 21:05
• I will check on the next prints if is a common movement since m84 is active to disable motors. Feb 23, 2018 at 1:01
• I´ve printed several parts and the problem is no appearing again, I thought that could be a large printing than the other one and I waited 3.5 hours and nothing. However just for printer's safety I will use G91 G1 Z5. Mechanically I think that is not possible that extruder can fall easily like cetus printer since mi printer is like Prusa i3 (screw support). But any overheat, magnetic field, Electrostatic interference, or a ghost could affect on that time; I will monitor all possible issues. Feb 26, 2018 at 8:02
• After two years I never had the same problem, but still I wondering why happened and remembered this issue yesterday while I was using the printer as plotter. Feb 21, 2020 at 8:06