---
tag: g012
title: Clean the Nozzle
brief: Perform the nozzle cleaning procedure.

experimental: true
since: 1.1.0
requires: NOZZLE_CLEAN_FEATURE
group: nozzle

codes: [ G12 ]

notes:
  - Default behavior is defined by `NOZZLE_CLEAN_STROKES`, `NOZZLE_CLEAN_START_POINT`, `NOZZLE_CLEAN_END_POINT`, `NOZZLE_CLEAN_TRIANGLES`, `NOZZLE_CLEAN_CIRCLE_MIDDLE`, `NOZZLE_CLEAN_CIRCLE_RADIUS` and `NOZZLE_CLEAN_GOBACK`.
  - With `NOZZLE_CLEAN_GOBACK` enabled, the nozzle automatically returns to the XYZ position before `G12`.

parameters:
  -
    tag: P
    optional: true
    description: Pattern style selection
    values:
      -
        tag: 0
        description: Linear move back and forth
      -
        tag: 1
        description: Move in a zigzag pattern
      -
        tag: 2
        description: Move in a circular pattern
  -
    tag: R
    optional: true
    description: Radius of nozzle cleaning circle
    values:
      -
        tag: radius
        type: float
  -
    tag: S
    optional: true
    description: Number of repetitions of the pattern
    values:
      -
        tag: count
        type: int
  -
    tag: T
    optional: true
    description: Number of triangles in the zigzag pattern
    values:
      -
        tag: count
        type: int
  -
    tag: X
    optional: true
    description: Include X motion when cleaning with limited axes. (Leave out `X`, `Y`, and `Z` for non-limited cleaning.)
    values:
      -
        type: flag
  -
    tag: Y
    optional: true
    description: Include Y motion when cleaning with limited axes. (Leave out `X`, `Y`, and `Z` for non-limited cleaning.)
    values:
      -
        type: flag
  -
    tag: Z
    optional: true
    description: Include Z motion when cleaning with limited axes. (Leave out `X`, `Y`, and `Z` for non-limited cleaning.)
    values:
      -
        type: flag

examples:
  -
    pre: The most basic example is to use the command without any arguments, this will default to a stroke based pattern which will be stroked `NOZZLE_CLEAN_STROKES` times.
    code: G12 ; stroke pattern (default)
  -
    pre: To generate a three triangle zig-zag pattern which will be stroked one time use the following command.
    code: G12 P1 S1 T3 ; zig-zag pattern with 3 triangles
  -
    pre: To generate a 10mm radius circle which will be stroked one time use the following command.
    code: G12 P2 S1 R10 ; 10mm circle

---

Start the nozzle cleaning process. Three types of cleaning patterns are supported: straight strokes, zigzags and circles. This feature requires a dedicated cleaning area on or outside the bed, but within reach of the nozzle. The pattern may be repeated as many times as desired.
