<p>I have a Monoprice Maker Select Plus, currently using Ultimaker Cura 3.6.0 with the default settings for a Wanhao Duplicator i3 Plus. Right now when a print finishes, the bed retreats towards the back of the machine. I'd rather present the bed forward for easier part removal.</p>

<p>Here is my ending G-Code:</p>

<pre>
M104 S0      ;extruder heater off 
G91          ;relative positioning
G1 E-1 F300  ;retract the filament a bit before lifting the nozzle, to release some of the pressure
G1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more
G28 X0 Y0    ;move X/Y to min endstops, so the head is out of the way
M84          ;steppers off
G90          ;absolute positioning
</pre>

<p>It looks like I need to change that <code>G28</code> line third from the bottom, but I'm not sure what to change it to. I've not yet done any g-code manipulation of my own. I don't know what units it's using, and it looks like it still has relative positioning, so even then I don't know it's a good idea to just set it for the max size of the bed. </p>

<p>So how can I change this code to move the bed as I want?</p>

[{'answer_id': 8185, 'author': 'Lux Claridge', 'author_id': 13883, 'author_profile': 'https://3dprinting.stackexchange.com/users/13883', 'pm_score': 2, 'selected': False, 'text': "<p>You're correct that the G28 line should be changed. What I would do is the following:</p>\n\n<pre><code>M104 S0 ;extruder heater off \nG91 ;relative positioning\nG1 E-1 F300  ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F{travel_speed} ;move Z up a bit and retract filament even more\nG28 X0 ;move X to min endstop, so the head is out of the way\nG90 ;absolute positioning\nG1 Y200 ;Move bed forward\nM84 ;steppers off\n</code></pre>\n\n<p>This way your X axis still gets homed after the Z bumps up and before Y moves to present the print.</p>\n\n<p>G28 is the command to home the print head. Your current settings homes the X and Y axes. G1 is a linear movement. One caveat to this change in G-Code is that there needs to be a home command at the start of your prints since you're not homing afterwards anymore. (I believe most slicers default to a G28 at the start AND end of prints so it's not a major concern, but one to be wary of now just in case.)</p>\n"}, {'answer_id': 8186, 'author': '0scar', 'author_id': 5740, 'author_profile': 'https://3dprinting.stackexchange.com/users/5740', 'pm_score': 4, 'selected': True, 'text': '<p>Note that <a href="https://reprap.org/wiki/G-code#G28:_Move_to_Origin_.28Home.29" rel="nofollow noreferrer">this reference</a> states that:</p>\n\n<blockquote>\n  <p>Because the behavior of <code>G28</code> is unspecified, it is recommended <strong>not</strong> to automatically include <code>G28</code> in your <strong>ending GCode</strong>. On a Cartesian this will result in damaging the printed object. If you need to move the carriage at the completion of a print, use <code>G0</code> or <code>G1</code>.</p>\n</blockquote>\n\n<p>So you need to use a <a href="https://reprap.org/wiki/G-code#G0_.26_G1:_Move" rel="nofollow noreferrer"><code>G0</code> or <code>G1</code></a> move.</p>\n\n<p>When using Ultimaker Cura (like many other slicers), there is built in functionality known as <a href="https://github.com/Ultimaker/Cura/issues/1131" rel="nofollow noreferrer">keywords</a> with a complete list found <a href="https://github.com/Ultimaker/Cura/blob/master/resources/definitions/fdmprinter.def.json" rel="nofollow noreferrer">here</a>.</p>\n\n<p>The keyword <code>machine_depth</code> is the one that is of use to you, embed this in your end G-code in between curly brackets and it will expand to the bed size of your machine (replacing <code>G28 X0 Y0</code>):</p>\n\n<p><code>G1 X0 Y{machine_depth}</code></p>\n\n<p>For me this compiles to (e.g. for my coreXY printer):</p>\n\n<p><code>G1 X0 Y300</code></p>\n\n<p>To set the speed, just add the following command prior to the one above:</p>\n\n<p><code>G1 F2500</code></p>\n\n<p>Adding this line before the actual move ensures that the speed is constant, if <code>F2500</code> would have been included in the move command (like <code>G1 X0 Y{machine_depth} F2500</code>), this defines the end speed, it would start moving at the last speed value prior to the move.</p>\n\n<p>This results in adding the following lines in your endscript:</p>\n\n<pre>\nG1 F2500\nG1 X0 Y{machine_depth}\n</pre>\n'}]
['https://3dprinting.stackexchange.com/questions/8184', 'https://3dprinting.stackexchange.com', 'https://3dprinting.stackexchange.com/users/12562/']