<p>How does Z offset (<code>M851</code>) work with an auto leveling sensor? Does it add the Z offset to the offset of the <code>G29</code> mesh? or the <code>G29</code> value replaces the <code>M851</code>?</p>
<p>My printer is an Anet A8 with Marlin firmware, I was having issues with the autoleveling sensor and reset the Z offset to 0 and let <code>G29</code> get the mesh offsets and its working good now.</p>
<p>I was looking through Marlin G-code page but couldn't figure out how <code>G29</code> affects <code>M851</code> or vice-versa.</p>
<p>My setup with level issues:</p>
<pre><code>M851 Z0
G28 
M211 S0 ;turned endstops off and got a paper to find the zoffset
M851 Z-0.59
M500
M211 S1
</code></pre>
<p>And <code>G29</code> before printing.</p>

[{'answer_id': 5858, 'author': '0scar', 'author_id': 5740, 'author_profile': 'https://3dprinting.stackexchange.com/users/5740', 'pm_score': 5, 'selected': True, 'text': '<p><code>G28</code> instructs the printer to home itself to the X an Y endstops and the Z sensor determines the homing of the Z axis; i.e. when the sensor triggers, this is not necessarily (and most commonly) not the position where the nozzle is at Z=0.</p>\n<p><code>G29</code> determines the shape of the bed by probing the bed. This will set the shape of the bed with respect to the sensor trigger point as described earlier. The Z-offset (set by <code>M851 Z-x.xx</code> is needed to set the offset between the nozzle and the sensor trigger point (to the bed).</p>\n<p>The sequence to determine the offset is:</p>\n<pre><code>M851 Z0; // Set the Z offset to zero height\nG28;     // Home Z in the middle of the bed\nG1 Z0;   // This will move the head to zero height;\nM211 S0; // This will disable the end stops so that you \n         // will be able to proceed lower than Z=0\n</code></pre>\n<p>Now adjust Z height to fit a piece of paper and note the negative Z height (either through the LCD or through an application or <a href="/q/10573">console/terminal</a> over USB)</p>\n<p><em>Please remember, that a sensor doesn\'t level your bed, is compensates for the shape, the user should always tram (level) the bed as good as possible with respect to the nozzle print head movement plane! This implies that the user should tram the complete bed as good as the skills allow, all corners, like you would do with a normal Z endstop switch.</em></p>\n<pre><code>M851 Z-1.23; // Define the Z offset\nM500;        // Store the settings\nM211 S1;     // Enable the end stops again\n</code></pre>\n<p>Please note that -1.23 is a fictive value that should be replaced by your own value.</p>\n<p>To explicitly answer the raised question, the <code>G29</code> probes the bed by scanning the surface geometry and the <code>M851</code> adds an offset for the sensor trigger to the nozzle (at the center). The offset is required to let the firmware know where the nozzle is with respect to the trigger point. The offset therefor lowers the scanned <code>G29</code> surface, no replacement is taking place. The sketches below illustrate this:</p>\n<p><a href="https://i.stack.imgur.com/wdto7.png" rel="nofollow noreferrer" title="BLTouch or 3DTouch sensor Z-offset definition"><img src="https://i.stack.imgur.com/wdto7.png" alt="BLTouch or 3DTouch sensor Z-offset definition" title="BLTouch or 3DTouch sensor Z-offset definition" /></a></p>\n<p><a href="https://i.stack.imgur.com/2sGwU.png" rel="nofollow noreferrer" title="Inductive/capacitive proximity sensor Z-offset definition"><img src="https://i.stack.imgur.com/2sGwU.png" alt="Inductive/capacitive proximity sensor Z-offset definition" title="Inductive/capacitive proximity sensor Z-offset definition" /></a></p>\n<p><em>note that the bottom line of the &quot;M851 Z offset&quot; denotes the <code>G29</code> scanned surface</em></p>\n'}, {'answer_id': 7222, 'author': 'Harly Hallikas', 'author_id': 13266, 'author_profile': 'https://3dprinting.stackexchange.com/users/13266', 'pm_score': 0, 'selected': False, 'text': "<p>You must use the sequence </p>\n\n<pre><code>G28\nG29\n</code></pre>\n\n<p>If you do <code>G28</code> after <code>G29</code> it will reset bed leveling. I guess you don't want that.</p>\n\n<p>On my printer deployed z-probe falls 2.3&nbsp;mm lower than nozzle. In printer settings I've therefore stored static Z-offset of -2.3&nbsp;mm, so after <code>G28</code> and <code>G29</code> I can be sure that when ever I tell Z-axis to lower to zero, it can go down -12.3&nbsp;mm, coming to stop at around 0.1&nbsp;mm above the bed surface (so just a single sheet of paper fits between the nozzle and the bed).</p>\n\n<p>That said, I'm not worrying about sending the Z-offset via print commands, as restart restores the aforementioned -2.3&nbsp;mm offset.</p>\n"}]
['https://3dprinting.stackexchange.com/questions/5857', 'https://3dprinting.stackexchange.com', 'https://3dprinting.stackexchange.com/users/9988/']