Coder Request: 10W Scanner

Recent discussion has given me ideas, but sadly while I can do a lot with g-code, I’m no good at any web language. There’s been some discussion about using the built-in thickness measurement on the 10W laser to make auto-adjustments to the Z height. While currently this is not an option, Z movement to follow objects is (if you use my non-planar guide). So here’s my idea and hopefully someone is smarter than I can implement it. :slight_smile:

A simple webpage with a few options for input;

Snapmaker IP (input the IP of your snapmaker, maybe there can be an auto-scan like Luban does to auto-fill)
Origin Location (The X/Y location of your intended origin)
Object Size (The size in mm of your planned project, maybe two boxes one for X and Y, or a combo doing X,Y format)
Interval spacing (How fine you want the mesh, small spacing takes longer, maybe default 10mm)
Laser offset (During my testing, the measurement laser hits the object 73mm in the X- compared to the blue diode, so this could be default, but you can test your own offset. I’ve not done Y offset tests yet)
Jog Speed (default 3000 or 6000 just to help speed things up, snapmaker uses 1500 in Luban)

The internal process would be after a user inputs these options, some simple math is done in the background to take your origin location (say 0,0) add the laser offset to ensure the red laser is on the actual origin (making it 73,0). These numbers are plugged into the web api to initiate the measurement cycle.

http://{Snapmaker IP}:8080/api/request_Laser_Material_Thickness?x={X Origin}&y={Y Origin}&feedRate={Jog Speed}

Then after it gets a response similar to this: {"status":true,"thickness":12.56268310546875} truncate to 2 decimal places, i.e. 12.56 and save this height at the X/Y location. Afterwards, augment the original X origin by the Interval Spacing, repeat until it reaches the Object Size. Do the same for Y so it moves up to the next row, and begin decreasing X back to the starting origin until it reaches the object size in Y.

Then take the saved positions and build an STL, kinda like a flat lithophane, to make a visualization of the scanned object. Between each point could be averaged to smooth it out, but pretty much mimicking the way the bed level visualizer plugin for octoprint works, just outputs to an STL.

The resulting STL could then be used to build the project on in Fusion360 or wherever so the movements can be non-planar and follow the object.

Or this could just be rambling and not really viable, is early morning and I’m still tired. :upside_down_face:

EDIT: According to how the toolhead moves from measuring to setting origin. There’s an X70 Y-8 difference.

Red measuring laser:
red

Blue diode laser:
blue

Unfortunately, AFAICT, the 10w laser focus system is entirely closed source. I see no references to it in the github firmware :frowning:.

(Unless of course, you have some GCODE command that can get the focus, 'cause if so, I’m basically building this idea right now (but, using a dial indicator and octoprint to automate @Tone’s “level gcode hot” idea)).

My method laid out above should work, using that URL I’m able to dictate where to move the toolhead to and run the measurement and it returns the thickness as shown above. You can try it yourself, just replace the snapmaker IP line to match yours, X/Y where you want it to measure at, and give it a feed speed. Visit that URL in any browser and it’ll begin moving and take the measurement at the X/Y location you set and return the thickness as I pasted above.

I’ve been using it the past couple days to almost completely automate my laser projects, the only thing I have to do is put the object on the platform.

My workflow is now this:

After fixating my object to the table and closing the enclosure.
1: Generate my project in Lightburn and export
2: Run the measuring API
3: Add G53 above the initial move + add Z(laser height+thickness from API) to the initial move line
4: Save and load into Luban
5: Start on Luban and when it asks thickness, just put an arbitrary high number (like 290) since I put the focal height in the gcode itself. (you can also just put in the measurement from step 2)
6: Close Luban if I don’t need to monitor/change things.

Saves a lot of walking back and forth, don’t have to manually jog it down to touch if not in the center, etc. I’ll of course do more testing to find more, but this is my current workflow.

1 Like

Oh! I misread your first post, I thought you were describing the API you wanted… this is super easy then, like just a few lines of javascript should do it lol (well, generating an STL might be tricky, but iterating over points and measuring is simple if there’s an API)

Maybe the source for image to lithophane could help.

Nice, looks doable, maybe at some point I could get to this.

Have you tried it on a curved object and does it actually work?

I assumed the thickness detection only worked reliably because it assumed the object was flat.
My assumption is that it looks at the location of the dot, moves the head down, looks at the new location of the dot and given the parameters you can estimate the thickness. But this assumes that the two measurement points are at the same height.

Note: I did not try this and haven’t used this feature (always manually set the right height) so I can definitely be wrong.

I’ve not tested a curved object yet, was on my list of tests to do yesterday but too many life things to do got in the way. Also, the two stage where it moves up and down is only in the calibration. During regular use, it just moves to the center, turns on the red laser for a second, then spits out the measurement.

Aha, ok. thanks for the clarification.

I should have a deeper look at it then and see how they implemented this. Summer holiday period is coming up for me and I was hoping to spend some time on my 3D touch probe experiments again (3D touch probe connected to can bus). This could be an alternative. (I’ve gotten the individual parts to work more or less but still need a lot more to get it really usable)

The actual interface needed could be exactly the same, just a different trigger.

I prefer the idea of the touch probe as it also allows to find edges (and thus the center of an object or hole) as well.

@Skreelink it’s been a bit, but I’ve figured out a bit of getting it to work:

Now to get it to actually produce an STL that’s not just a weird slanted plane…

Now we’re cookin’ with gas :smiley:

1 Like

Dw46LSWXcAEQ5-A

1 Like

I have an idea! Use the MBL setup in Marlin. I was playing around with it a little bit with my 10W hooked up and did M420 S to enable it, followed by M420 V to print out the table, and all points are listed +9mm. So I followed up with a G0 Z0 and indeed it came down to Z0 + 9. Afterwards I disabled with M420 S0, and another G0 Z0, and boop, came back down that 9mm. You can actually see in the work origin in Luban (and machine coords) the 9mm being added/subtracted as you turn it on and off.

So I’m thinking a script that runs curl in several spots (adding offset for the laser) and for each line, it reads the thickness, followed by writing the MBL manually for that location.

i.e. for a mesh point @ 10,10 do something like Actual I/J locations for mesh points below, I0 J0 is
curl -X GET "http://XXX.XXX.XXX.XXX:8080/api/request_Laser_Material_Thickness?x=99&y=22&feedRate=6000"

It pulls the thickness, say 5.55mm (truncate to 2 decimal places), then that variable is put into another curl command with the execute code API and M421 to set mesh value. Any “false” returns should be set to 0, as that should be bare bed.

curl -X POST "http://XXX.XXX.XXX.XXX:8080/api/v1/execute_code?token=[TOKEN HERE]&code=M421I0J0Z5.55"

After probing all the spots, make sure it’s turned on with M420 S (also make sure to place this in the header of any gcode AFTER G28, since G28 turns it off).

EDIT: I set one point to +20 and moved the laser around in a square, it was freaky watching it go up and down automatically. So using G1029P11 to set an 11x11 matrix and doing a scan, might get a rudimentary, but usable mesh.

EDIT2: Setting the mesh to 11x11, I found out that I0 J0 is X29 Y24 (in machine coords). Each increment on X is +27, so I0 is X29, I1 is X56, and so on. Each increment on Y is +30, so J0 is Y24, J1 is Y54, and so on. So in theory, taking each of these grid locations, and doing the math for the thickness API of X70 Y-8, you SHOULD be able to build a mesh of anything you put on the bed, then material thickness becomes moot as Z0 will always be the height of the material. It won’t be as smooth as say, an STL model of whatever you’re lasering, but with points every ~inch² should get a good reference for height.

EDIT3: Sadly with the 70mm offset in X, that means only 9 points on X can be used, as anything I9 and above is too far to add the 70mm for the thickness laser. (for reference I8, or the 9th point on X is 245 + 70 = 315. I9 is is X272 + 70 = 342, which is outside of X’s range of movement.)

Yea, that’s a cool idea, but like you said, if you’re only allowed 11x11 points across the whole bed, I’d think it’d be fairly likely that the machine would be out of focus more often than not. Your idea might work if you were able to e.g. pretend the bed is smaller than it is, and still use 11x11 mesh, but even then I’d want to apply the mesh at a 1mm resolution to ensure you’re maintaining proper focus when lasering. (and, you’d probably need sub-mm resolution if you wanted to do anything w/ 3dprinting on the object).

I still believe in your original idea, and using something like GitHub - Heinz-Loepmeier/nozzleboss to take the input gcode (nc is just gcode w/ a different file extension) and deforming it along the mesh generated by the measuring tool.

Maybe since you’re already thinking about it, you could check and see if using nozzleboss to deform laser files works. I asked in the lightburn forums and there was talk of adding mesh deformation “someday”, but it’s currently not a thing. Another thing to check out would be to see if you could actually use luban to do the “mesh offset lasering”, since I assume it’s got all the code for generating the gcode paths, and it’d probably be simpler to add in the mesh offset.

Sadly I have zero experience with Blender, but the idea is one I’ve looked around for and came up empty handed. Was trying to find a way to post-process the gcode files to add Z height mesh to it. It seems plausible with the nozzleboss thing you linked, but again, I’ve no blender experience.

It would really be nice if there was a gcode method to grab and save height instead of having to use the API. Putting a line to automatically find the height directly in the header would be magnificent.

I actually managed to get the idea above done and it does work decent. I’ll post more info and things after I get home from work.

EDIT:

Here it is… a bed scanner. It follows the MBL points of an 11x11 matrix (though only 9 points on X due to the laser offset) so 99 points in total.
BedScan.zip (1.0 MB)
There’s the .bat file, replace [IP HERE] with your snapmaker IP, and [TOKEN HERE] with your token. Also included is jq.exe which is version 1.6 for windows x64. It’s just a single exe, no installing, just make sure it’s in the same folder as the .bat. Any other version can be found here Redirecting to jqlang.github.io. This is for parsing the responses from the web api.

Simply connect with either Luban or my keepalive from my drag/drop thread:

Then run the bed scan, and it should take roughly right at 9 minutes to run and it’ll spit out a txt file with your probe info and set all the MBL points on the snapmaker. The resulting text file will look like this:

Bilinear Leveling Grid:
      0      1      2      3      4      5      6      7      8      9     10
 0 +5.187 +5.104 +5.252 +5.422 +5.600 +5.315 +5.233 +0.000 +0.000 +9.000 +9.000
 1 +5.252 +5.223 +5.266 +5.255 +5.404 +5.239 +5.241 +0.000 +0.723 +9.000 +9.000
 2 +0.000 +0.000 +0.000 +0.010 +0.000 +0.184 +0.000 +0.000 +0.361 +9.000 +9.000
 3 +0.000 +0.000 +0.000 +0.000 +0.000 +0.010 +0.010 +0.000 +0.558 +9.000 +9.000
 4 +0.000 +0.000 +0.338 -0.141 +0.000 +0.010 +0.010 +0.000 +0.010 +9.000 +9.000
 5 +0.000 +0.000 +0.000 +0.010 +0.000 +0.010 +7.658 +11.901 +12.077 +9.000 +9.000
 6 +0.000 +0.000 +0.000 -0.350 +0.000 +12.220 +11.960 +12.033 +12.074 +9.000 +9.000
 7 +0.000 +0.000 -87.779 +0.000 +0.000 +12.062 +11.979 +11.763 +11.908 +9.000 +9.000
 8 +0.000 +0.000 +0.000 +0.000 +0.000 +11.795 +11.898 +12.036 +11.911 +9.000 +9.000
 9 +0.000 +0.000 -3.241 +0.010 +0.000 +11.715 +11.727 +11.915 +12.043 +9.000 +9.000
10 +0.000 +0.000 -84.294 +0.000 +0.000 +0.010 +0.010 +0.000 +0.010 +9.000 +9.000

Subdivided with CATMULL ROM Leveling Grid:
        0        1        2        3        4        5        6        7        8        9       10       11       12       13       14       15       16       17       18       19       20       21       22       23       24       25       26       27       28       29       30
 0 +5.18678 +5.15049 +5.11419 +5.10361 +5.13509 +5.19229 +5.25189 +5.30663 +5.36378 +5.42183 +5.49771 +5.57450 +5.59985 +5.53168 +5.41207 +5.31502 +5.46349 +5.63451 +5.23317 +3.67654 +1.54754 +0.00000 -0.72098 -0.86049 +0.00000 +2.66667 +6.33333 +9.00000 +9.66667 +9.33333 +9.00000
 1 +5.40562 +5.37775 +5.34988 +5.34144 +5.36570 +5.40939 +5.45213 +5.48419 +5.51531 +5.55430 +5.62251 +5.69860 +5.72732 +5.66671 +5.55872 +5.47402 +5.64339 +5.83604 +5.43020 +3.80760 +1.58651 +0.00000 -0.64189 -0.64920 +0.28103 +2.88525 +6.42701 +9.00000 +9.64585 +9.32292 +9.00000
 2 +5.62446 +5.60502 +5.58558 +5.57928 +5.59631 +5.62649 +5.65237 +5.66175 +5.66683 +5.68676 +5.74731 +5.82270 +5.85478 +5.80173 +5.70538 +5.63302 +5.82329 +6.03756 +5.62723 +3.93865 +1.62548 +0.00000 -0.56281 -0.43792 +0.56207 +3.10383 +6.52069 +9.00000 +9.62503 +9.31251 +9.00000
 3 +5.25241 +5.24010 +5.22779 +5.22342 +5.23428 +5.25308 +5.26595 +5.26034 +5.24879 +5.25497 +5.30432 +5.37139 +5.40364 +5.36574 +5.29302 +5.23885 +5.42140 +5.62251 +5.24104 +3.66154 +1.49945 +0.00000 -0.48068 -0.29874 +0.72263 +3.22871 +6.57421 +9.00000 +9.61314 +9.30657 +9.00000
 4 +3.70100 +3.69411 +3.68723 +3.68461 +3.69061 +3.70088 +3.70671 +3.69938 +3.68762 +3.68887 +3.71863 +3.76140 +3.78803 +3.78371 +3.76326 +3.74196 +3.85928 +3.97575 +3.68836 +2.56704 +1.04185 +0.00000 -0.38598 -0.28863 +0.66168 +3.18131 +6.55390 +9.00000 +9.61765 +9.30883 +9.00000
 5 +1.55870 +1.55594 +1.55318 +1.55212 +1.55429 +1.55815 +1.56080 +1.55946 +1.55689 +1.55850 +1.56516 +1.57600 +1.59381 +1.63066 +1.67448 +1.69191 +1.71536 +1.71241 +1.55247 +1.06436 +0.41925 +0.00000 -0.28824 -0.35063 +0.48027 +3.04021 +6.49342 +9.00000 +9.63109 +9.31554 +9.00000
 6 +0.00000 +0.00000 +0.00000 +0.00000 -0.00036 -0.00073 +0.00000 +0.00328 +0.00765 +0.00984 +0.00084 -0.01036 +0.00000 +0.06065 +0.14285 +0.18413 +0.14321 +0.06138 +0.00000 -0.02701 -0.03356 +0.00000 -0.21302 -0.38593 +0.36095 +2.94740 +6.45365 +9.00000 +9.63993 +9.31996 +9.00000
 7 -0.38907 -0.50110 -0.61314 -0.38692 +0.62831 +1.98180 +2.65948 +1.98651 +0.63773 -0.37639 -0.61421 -0.51736 -0.40027 -0.34981 -0.27911 -0.24193 -0.28696 -0.36551 -0.38532 -0.29706 -0.15006 +0.00000 -0.16716 -0.33125 +0.41290 +2.98781 +6.47097 +9.00000 +9.63608 +9.31804 +9.00000
 8 -0.19453 -0.41997 -0.64541 -0.19346 +1.83866 +4.54817 +5.90406 +4.55348 +1.84930 -0.18092 -0.64011 -0.42532 -0.20013 -0.17723 -0.14392 -0.12572 -0.14536 -0.18010 -0.18721 -0.15581 -0.09678 +0.00000 -0.14381 -0.24988 +0.52695 +3.07652 +6.50898 +9.00000 +9.62763 +9.31381 +9.00000
 9 +0.00000 +0.00000 +0.00000 +0.00000 +0.00000 +0.00000 +0.00000 +0.00000 +0.00000 +0.00000 -0.00037 -0.00073 +0.00000 +0.00292 +0.00694 +0.00986 +0.01094 +0.01092 +0.00981 -0.01377 -0.03844 +0.00000 -0.14800 -0.23290 +0.55817 +3.10080 +6.51939 +9.00000 +9.62532 +9.31266 +9.00000
10 +0.00000 +1.01652 +2.03303 +0.00000 -9.14686 -21.34327 -27.44593 -21.36285 -9.18600 -0.04804 +1.99578 +1.00073 +0.00000 +0.01264 +0.01960 -0.00306 -0.07696 -0.18049 -0.27273 -0.35746 -0.43091 -0.44077 -0.66817 -0.83199 -0.03664 +2.67082 +6.33745 +9.00000 +9.66938 +9.33469 +9.00000
11 +0.00000 +2.37187 +4.74374 +0.00000 -21.34273 -49.80107 -64.04048 -49.84614 -21.43287 -0.11063 +4.65756 +2.33474 +0.00000 +0.02993 +0.04795 +0.00339 -0.15017 -0.36629 -0.55636 -0.70037 -0.81832 -0.88155 -1.21587 -1.49547 -0.71429 +2.17641 +6.12789 +9.00000 +9.71958 +9.35979 +9.00000
12 +0.00000 +3.04955 +6.09909 +0.00000 -27.44071 -64.03005 +0.33777 -64.08743 -27.55546 -0.14084 +5.98919 +3.00187 +0.00000 +0.01335 +0.01214 +0.00984 +0.01093 +0.01091 +0.00981 +0.00654 +0.00218 +0.00000 -0.33079 -0.65940 +0.00981 +2.67430 +6.33660 +9.00000 +9.66594 +9.33297 +9.00000
13 +0.00000 +2.37187 +4.74374 +0.00000 -21.34338 -49.80236 -64.04049 -49.84037 -21.41940 -0.09332 +4.68754 +2.37353 +0.00000 -0.21894 -0.49741 -0.44239 +0.23104 +1.23795 +2.11661 +2.72150 +3.19813 +3.52130 +3.43029 +3.18581 +3.54485 +5.16294 +7.38453 +9.00000 +9.40409 +9.20204 +9.00000
14 +0.00000 +1.01652 +2.03303 +0.00000 -9.14814 -21.34583 -27.44592 -21.35129 -9.15906 -0.01340 +2.05574 +1.07832 +0.00000 -0.48511 -1.07111 -0.89461 +0.68545 +3.02800 +5.07321 +6.48627 +7.60198 +8.36492 +8.62414 +8.53057 +8.48163 +8.64387 +8.85073 +9.00000 +9.03840 +9.01920 +9.00000
15 +0.00000 +0.00000 +0.00000 +0.00000 -0.00036 -0.00073 +0.00000 +0.00328 +0.00765 +0.00984 +0.00729 +0.00255 +0.00000 -0.28108 -0.55997 +0.00984 +2.11956 +5.07799 +7.65805 +9.47520 +10.91397 +11.90091 +12.38140 +12.41004 +12.07719 +11.17849 +9.91829 +9.00000 +8.77206 +8.88603 +9.00000
16 +0.00000 -0.34630 -0.69261 +0.00000 +3.12037 +7.27964 +9.35017 +7.23955 +3.04018 -0.09841 -0.90372 -0.64826 +0.00000 +0.86666 +2.12611 +3.63352 +5.51706 +7.64857 +9.49871 +10.91536 +12.05064 +12.83165 +13.26860 +13.35128 +12.97612 +11.80871 +10.18346 +9.00000 +8.70547 +8.85274 +9.00000
17 +0.00000 -0.35377 -0.70753 +0.00000 +3.19366 +7.44861 +9.55170 +7.34132 +2.97908 -0.26334 -1.23138 -1.07961 +0.00000 +2.48459 +5.89702 +8.61388 +9.89427 +10.47908 +10.96761 +11.57967 +12.09543 +12.45475 +12.71922 +12.82723 +12.53382 +11.49262 +10.04998 +9.00000 +8.73824 +8.86912 +9.00000
18 +0.00000 +0.00000 +0.00000 +0.00000 +0.01294 +0.02589 +0.00000 -0.11650 -0.27184 -0.34950 -0.72443 -1.02169 +0.00000 +3.65624 +8.63142 +12.21999 +13.04559 +12.48458 +11.96048 +11.96128 +11.99897 +12.03310 +12.16430 +12.29192 +12.07355 +11.16586 +9.91218 +9.00000 +8.77233 +8.88616 +9.00000
19 +0.00000 +1.08369 +2.16739 +0.00000 -9.74314 -22.73736 -29.25971 -22.84841 -9.96523 -0.27256 +1.47067 +0.02340 +0.00000 +3.92759 +9.27905 +13.08747 +13.83230 +13.03409 +12.28754 +12.12639 +12.01691 +11.95260 +12.06101 +12.21458 +12.02418 +11.13343 +9.89870 +9.00000 +8.77599 +8.88799 +9.00000
20 +0.00000 +2.52862 +5.05723 +0.00000 -22.75322 -53.09229 -68.27264 -53.13990 -22.84844 -0.11687 +4.50039 +1.55776 +0.00000 +3.75265 +8.89017 +12.58070 +13.39313 +12.75857 +12.13856 +12.00880 +11.89359 +11.82735 +11.95218 +12.12597 +11.95684 +11.09033 +9.88089 +9.00000 +8.78098 +8.89049 +9.00000
21 +0.00000 +3.25108 +6.50216 +0.00000 -29.25971 -68.27264 -87.77911 -68.27264 -29.25970 +0.00000 +6.05542 +2.35761 +0.00000 +3.57695 +8.49411 +12.06181 +12.93862 +12.46598 +11.97858 +11.90300 +11.81266 +11.76251 +11.89737 +12.07242 +11.90816 +11.05727 +9.86707 +9.00000 +8.78458 +8.89229 +9.00000
22 +0.00000 +2.52417 +5.04834 +0.00000 -22.71848 -53.00948 -68.15261 -52.99908 -22.69768 +0.02553 +4.62472 +1.64573 +0.00000 +3.54634 +8.42595 +11.97384 +12.86234 +12.41911 +11.96225 +11.91921 +11.86253 +11.82788 +11.94395 +12.08204 +11.89174 +11.03966 +9.85918 +9.00000 +8.78580 +8.89290 +9.00000
23 +0.00000 +1.07480 +2.14960 +0.00000 -9.67366 -22.57173 -29.01963 -22.56675 -9.66371 +0.01222 +1.71934 +0.19934 +0.00000 +3.51498 +8.35062 +11.87375 +12.77072 +12.35518 +11.93492 +11.94721 +11.95479 +11.95365 +12.04455 +12.12673 +11.89398 +11.03209 +9.85526 +9.00000 +8.78563 +8.89281 +9.00000
24 +0.00000 +0.00000 +0.00000 +0.00000 +0.00000 +0.00000 +0.00000 +0.00000 +0.00000 +0.00000 -0.43684 -0.87367 +0.00000 +3.49086 +8.29223 +11.79456 +12.69367 +12.29373 +11.89767 +11.95083 +12.00785 +12.03566 +12.11666 +12.16843 +11.91069 +11.03901 +9.85780 +9.00000 +8.78439 +8.89220 +9.00000
25 +0.00000 -0.31644 -0.63288 +0.00000 +2.84783 +6.64498 +8.54385 +6.64631 +2.85049 +0.00327 -1.08162 -1.21793 +0.00000 +3.60673 +8.56770 +12.18484 +13.10731 +12.68596 +12.27525 +12.33953 +12.41444 +12.46140 +12.58155 +12.67374 +12.39589 +11.38485 +10.00376 +9.00000 +8.74846 +8.87423 +9.00000
26 +0.00000 -0.25831 -0.51662 +0.00000 +2.32451 +5.42395 +6.97437 +5.42706 +2.33073 +0.00763 -0.97720 -1.18880 +0.00000 +3.72985 +8.86011 +12.59602 +13.53552 +13.08067 +12.64289 +12.70383 +12.78183 +12.84336 +13.01795 +13.17607 +12.89555 +11.74518 +10.15617 +9.00000 +8.71144 +8.85572 +9.00000
27 +0.00000 +0.12003 +0.24007 +0.00000 -1.08067 -2.52144 -3.24092 -2.51745 -1.07268 +0.00981 -0.18620 -0.74450 +0.00000 +3.47005 +8.24289 +11.71538 +12.57983 +12.14393 +11.72749 +11.77915 +11.85028 +11.91487 +12.07956 +12.23770 +12.04341 +11.15118 +9.90651 +9.00000 +8.77456 +8.88728 +9.00000
28 +0.00000 +0.90721 +1.81443 +0.00000 -8.16523 -19.05210 -24.49479 -19.04884 -8.15871 +0.00799 +1.49936 +0.26731 +0.00000 +2.56962 +6.10399 +8.67474 +9.31280 +8.98724 +8.67698 +8.71428 +8.76688 +8.81688 +8.85932 +8.89915 +8.93343 +8.96179 +8.98459 +9.00000 +9.00493 +9.00247 +9.00000
29 +0.00000 +2.01461 +4.02922 +0.00000 -18.13164 -42.30711 -54.39447 -42.30548 -18.12838 +0.00400 +3.87150 +1.69429 +0.00000 +1.28627 +3.05546 +4.34229 +4.66187 +4.49909 +4.34341 +4.36042 +4.38453 +4.40844 +4.26427 +4.11989 +4.47164 +5.81806 +7.66060 +9.00000 +9.33543 +9.16772 +9.00000
30 +0.00000 +3.12201 +6.24401 +0.00000 -28.09806 -65.56212 -84.29416 -65.56213 -28.09805 +0.00000 +6.24365 +3.12128 +0.00000 +0.00292 +0.00693 +0.00984 +0.01094 +0.01094 +0.00984 +0.00656 +0.00219 +0.00000 -0.33078 -0.65936 +0.00986 +2.67433 +6.33662 +9.00000 +9.66594 +9.33297 +9.00000

echo:Bed Leveling OFF
echo:Fade Height OFF
ok

You can even toss these into a mesh bed visualizer and see the objects on the bed (however, they all seem to max out at 2mm, so anything taller just goes ZOOP.



It does seem to hit the screws in the bed and might cause a wildly negative number (I had a couple -87mm) so keep that in mind. However, making a quick project in Lightburn, I completely ignored setting the thickness, and simply put an M420 S at the end of my header to enable MBL aaand it worked fine. Would I recommend? Nah, especially for flat objects. Was it a fun adventure? Sure. Was it also frustrating trying to parse the results? Definitely.

Hah, I love that batch file.

I suppose I could make a version of the thing I’m doing that just scans the points like that, I was learning svelte to make a nice GUI.

In the batch file, you use both gcode and M421, IDK if both are necessary since the Material_Thickness command would move the head anyways.

They are. The first line runs the thickness api and parses the output to a temp file, then the contents are read as a variable and plunked into the M421 line. The M421 line is the one that actually saves it to the MBL data on the snapmaker.