---
tag: m0421
title: Set Mesh Value
brief: Set a single mesh Z height
author: thinkyhead

group: motion
requires: AUTO_BED_LEVELING_(BILINEAR|UBL)|MESH_BED_LEVELING

codes: [ M421 ]
related: [ G29, M420 ]

parameters:

- tag: I
  optional: true
  description: X index into the mesh array
  values:
  - tag: index
    type: int

- tag: J
  optional: true
  description: Y index into the mesh array
  values:
  - tag: index
    type: int

- tag: X
  optional: true
  description: X position (which should be very close to a grid line) (`MESH_BED_LEVELING` only)
  values:
  - tag: linear
    type: float

- tag: Y
  optional: true
  description: Y position (which should be very close to a grid line) (`MESH_BED_LEVELING` only)
  values:
  - tag: linear
    type: float

- tag: Z
  optional: true
  description: The new Z value to set
  values:
  - tag: linear
    type: float

- tag: Q
  optional: true
  description: A value to add to the existing Z value
  values:
  - tag: linear
    type: float

- tag: C
  optional: true
  description: Set the mesh point closest to the current nozzle position (`AUTO_BED_LEVELING_UBL` only)
  values:
  - type: bool

- tag: N
  optional: true
  description: Set the mesh point to undefined (`AUTO_BED_LEVELING_UBL` only)
  values:
  - type: bool

examples:
- pre: Set the Z height in the middle of a 5x5 grid
  code: M421 I2 J2 Z-0.05
- pre: Set the same Z height using XY
  code: M421 X100 Y100 Z-0.05
- pre: Adjust the mesh point by -0.01
  code: M421 I2 J2 Q-0.01

---

This command is used to set a single Z value for a mesh point in the stored bed leveling data.

Allowed forms are `M421 In Jn Zn`, `M421 Xn Yn Zn` (`MESH_BED_LEVELING` only) or `M421 C Zn` (`AUTO_BED_LEVELING_UBL` only).
