G Code for Bed Level Visualizer

Octoprint has this great plug-in to visualize the bed Bed Level Visualizer but it requires the printer to provide the information. What G Code can I use?

Marlin uses G29 T, Prusa G80, G81,…

1 Like

M420 V will output the mesh. https://marlinfw.org/docs/gcode/M420.html

1 Like

Thanks, will try after the current print is finished

Hi! Please, can you show me the GCode you use? I have no idea about GCode.

In the plugin config:

G1029P7 ;Grid 3x3 5x5 11x11
G1029A ;leveling;
G1029S ;save data;
G1029D0 ;end leveling
M420V ;get data

Thank you for the parameters!

These would only save the data calibrate from the sensor right? Distance between sensor and bed.
What about the data offset of the distance between the nozzle and bed? Like the last part of auto-calibration

The M420V command will read the mesh for the Octoprint bed level visualizer, the G1029 codes are to run the automatic bed level.

Just to clarify for anyone coming here later:

All you actually need to put into GCODE section is the M command to get the data out:

M420 V

If you’re not seeing any output, it’s probably that the output is outside of the graph range (defaults to -2,2), switch over to the terminal command and check the output of the M420 V command and make sure that your graph bounds are set to include it.

Example, all my values are in the 7 range, so I didn’t see anything in the graph:

Recv: Bilinear Leveling Grid:
Recv:       0      1      2      3      4      5      6
Recv:  0 +7.191 +7.314 +7.470 +7.520 +7.534 +7.465 +7.476
Recv:  1 +7.451 +7.544 +7.670 +7.675 +7.734 +7.705 +7.589
Recv:  2 +7.330 +7.440 +7.525 +7.558 +7.629 +7.632 +7.567
Recv:  3 +7.277 +7.409 +7.474 +7.452 +7.531 +7.587 +7.520
Recv:  4 +7.228 +7.308 +7.349 +7.345 +7.412 +7.461 +7.454
Recv:  5 +7.218 +7.250 +7.332 +7.277 +7.347 +7.372 +7.349
Recv:  6 +7.150 +7.079 +7.142 +7.086 +7.126 +7.124 +7.169

I had to go and set Graph Z-Limits to be able to show my graph:

1 Like

Or you can check the box “use relative z-offsets”


Does anyone know why after running the Bed Visualizer I’ve got only message “Please wait, retrieving current mesh.”

What do your settings look like?
Do you have a thicker than normal bed? (for example, do you have a glass bed on top, printbed on top of cnc bed etc)

(Nobody here has a crystal ball, you should always try and provide as much background info as possible)

1 Like

Looks like your bed is out of range od BV. Test -5.0,5 or somthing like that.
Are you using the latest Version ov BV? What says the octoprint forum?

I am using the “Nylon locknut” method so the bed is thicker (about 5-6mm) and the bed is on top the platform (I got not flat platform). Looking at M420V, I set the Graph Z-limits to 15.2, and Use Relative Z Offsets (ticked) I waited the graph until it is time out.

Then after about 30 minutes:

Screen Shot 2021-02-23 at 09.44.44

Then you need to install the last release candidate of the plugin. There previous version didn’t support double digit offsets. As you are at 14+mm the current version doesn’t work.

Go to the plugin manager and there is a drop down that allows you to select the release candidate in stead of the stable version.

This doesn’t do what you think. If you use relative z-offsets you should enter something like “- 1,1”. That means the graph will show the 2mm around your height.
So if your origin is at 15, the z-axis shows the range 14-16.

The default value is - 2,2.(if you leave it empty)

Thank you so much for all the information. It Works now…
Really appreciate it, thanks :pray:t2:


Some G-code commands for Snapmaker 2.0.

M500 //M502&M500 Restore Factory Defaults
M2000 S0 //M200 S0 Controller Status
M1999 //M1999 Reboot Log
M1005 //M1005 Firmware Info
M420 V //M420 V Bed Leveling Data
M119 //M119 Limit&Proximity Switch Status
M503 //M503 Controller Settings
M1006 //M1006 Toolhead Status
M1007 //M1007 Origin Info