# Drawing simple circle in G-code [duplicate]

I thought I am not bad at Google, but simply I am unable to find a G-code for doing circular motion for nozzle cleaning. It is possible to write a simple circular motion in G-code?

• Marlin's g-code reference is so good that I don't Google for this kind off information anymore; I go rightly to it. Dec 25, 2021 at 21:43

To draw a circle, you need to approximate the circle as a sufficient number of line segments. This requires computing or using a table of sine and cosine values for each angle step. Then you just emit a sequence of G1 commands.

Some printer firmware also supports arc drawing commands you could use instead in principle, but support is not widespread, and the quality of the results varies enough that I would not recommend trying to do it this way.

While many 3D printers support using G2 and G3 for circles and arcs, most people are not used to them because the STL files consist entirely of flat triangles (straight lines).

If you want a simple 2D circle, see the following for help:

https://marlinfw.org/docs/gcode/G002-G003.html