<p>It really depends on whether you currently have something half printed on the bed when you need to do maintenance. 
For example, you may have a blockage mid-print or need to reprime the nozzle. </p>

<p>So with that in mind, personally I would separate the line that does the move into two different lines. </p>

<p>Move vertically first, then in X Y. Otherwise, the print head may move diagonally and hit your object. This is because the head will move all three axes at once.</p>

<p>Otherwise looks good.</p>

<p>Edit: Another suggestion is that if you use repetier host to control the printer it will be easier to return to the print in-progress automatically.</p>

<p>Also take a look at the S parameter, for moves it can control how fast the move is.</p>

CC BY-SA 3.0
2017-01-19T19:35:48.603Z
2017-01-19T19:35:48.603Z
ArkTekniK
<p>Yes, on machines which will execute "standard" gcode, this will do what you request. Some good resources are <a href="http://reprap.org/wiki/G-code">http://reprap.org/wiki/G-code</a> and <a href="https://en.wikipedia.org/wiki/G-code">https://en.wikipedia.org/wiki/G-code</a></p>

CC BY-SA 3.0
2017-01-18T12:34:37.883Z
2017-01-18T12:34:37.883Z
Davo
<p>I've got a Monoprice Mini Select (15365) and it takes FOREVER for me to manually spin the dial to get the printhead to raise all the way up so that I can perform maintenance (clear blockages in the nozzle or apply new tape to the bed, etc).</p>

<p>So, I was thinking about writing a snippet of gcode that I could just run which would contain the commands necessary to do that for me. I'm a n00b to 3D printing, but I'm an old programmer so I figured it would be too hard. However, before running this code on my printer, I wanted to get some experts to double check me to make sure I'm not going to hurt anything. :)</p>

<p>Here is what I have, please let me know if I've done anything wrong or if you have any suggestions.</p>

<pre><code>; Move print head to center and top to prepare for cleaning/maintenance

M107    ; fan off
G28 ; home all axes
G21 ; set units to millimeters
G90 ; use absolute coordinates

; full dimensions of the print area are 120mm x 120mm x 120mm
G0 X60 Y60 Z119 ; move to center X,Y and just below the max height

M84     ; disable motors
</code></pre>

<p>I grabbed a few lines from gcode generated by Slic3r and used the gcode wiki entry to understand each of the commands and fill in the extra ones I needed.</p>

<g-code>
gcode to move the printhead up for maintenance
Kenny Wyland
# gcode to move the printhead up for maintenance

(Asked by: username_0 on 2017-01-18)

I've got a Monoprice Mini Select (15365) and it takes FOREVER for me to manually spin the dial to get the printhead to raise all the way up so that I can perform maintenance (clear blockages in the nozzle or apply new tape to the bed, etc).

So, I was thinking about writing a snippet of gcode that I could just run which would contain the commands necessary to do that for me. I'm a n00b to 3D printing, but I'm an old programmer so I figured it would be too hard. However, before running this code on my printer, I wanted to get some experts to double check me to make sure I'm not going to hurt anything. :)

Here is what I have, please let me know if I've done anything wrong or if you have any suggestions.

```
; Move print head to center and top to prepare for cleaning/maintenance

M107    ; fan off
G28 ; home all axes
G21 ; set units to millimeters
G90 ; use absolute coordinates

; full dimensions of the print area are 120mm x 120mm x 120mm
G0 X60 Y60 Z119 ; move to center X,Y and just below the max height

M84     ; disable motors

```

I grabbed a few lines from gcode generated by Slic3r and used the gcode wiki entry to understand each of the commands and fill in the extra ones I needed.

**Tags:** g-code


---

## 2 answers

### Answer by username_2 on 2017-01-18. Score: 5 | Accepted answer

Yes, on machines which will execute "standard" gcode, this will do what you request. Some good resources are <http://reprap.org/wiki/G-code> and <https://en.wikipedia.org/wiki/G-code>


---

### Answer by username_1 on 2017-01-19. Score: 2

It really depends on whether you currently have something half printed on the bed when you need to do maintenance.
For example, you may have a blockage mid-print or need to reprime the nozzle.

So with that in mind, personally I would separate the line that does the move into two different lines.

Move vertically first, then in X Y. Otherwise, the print head may move diagonally and hit your object. This is because the head will move all three axes at once.

Otherwise looks good.

Edit: Another suggestion is that if you use repetier host to control the printer it will be easier to return to the print in-progress automatically.

Also take a look at the S parameter, for moves it can control how fast the move is.


---

