Guide: Automatic Start via Drag/Drop

Oh wait, that bug is apparently still there. :upside_down_face: The snapmaker controller can’t parse comments correctly, whereas Lightburn can. That’s why it works in Lightburn, but not sent to the machine. Simply remove all the ; from your header gcode (or copy below).

G28
G90
G53
G0 Z25 F6000
G54
G92 Z0
G0 Z200
G53
G0 X4 Y0 F6000
G54
G92 X-1.7 Y4.5
M3 S0

I tested and verified that was the problem by using your file (modifying in my own focus height and material) running it and noticed the wonk, then noticed the semicolons and removed them and it ran fine afterwards.

Found this bug way back in March on firmware 1.15.x

Thanks a lot Skreelink. I even remember reading about this. But it never came to my mind to check that :see_no_evil:

Hey Skreelink,

I love the work you’re doing! The instructions were super simple, and BOOM I’m already able to send commands to the snapmaker wirelessly. It’s great!

I’ve got two questions:

  1. Do you know how I can send files to the snapmaker without starting the job so that I can start it on the machine?
    I tried simply deleting the “start job” command line, but the file will not appear in the local storage of the Snapmaker. (I could always use sm2uploader, but it would be cool to do it this way)

  2. Where are you finding the API codes in order to figure out all this stuff?

Thank you for your time!

K_8D

The API call is upload, make a bat with this instead;

@echo on
curl -X POST "http://[IP HERE]:8080/api/v1/connect?token=[TOKEN HERE]"
curl -X GET "http://[IP HERE]:8080/api/v1/status?token=[TOKEN HERE]"
curl -X POST -F file=@"%~1" "http://[IP HERE]:8080/api/v1/upload?token=[TOKEN HERE]"
curl -X POST "http://[IP HERE]:8080/api/v1/connect?token=[TOKEN HERE]"
curl -X GET "http://[IP HERE]:8080/api/v1/status?token=[TOKEN HERE]"
pause

Besides research on various forums and whatnot, reading through the source code on the github. :upside_down_face:

1 Like

That is fantastic!! Thanks a bunch!

If you’ve got a spare moment, a list of all the API codes for Snapmaker you’ve gathered over the years would be really handy if you have such a thing kicking around.

Thanks again!

Where do I find the token stored on a Mac? Or is there another way to find the token? I have looked for machine.json on the Mac, but I don’t find it. I did also look inside of the Contents of the SnapMaker Luban Application. I don’t find it in there either. Or if it was in there, I didn’t see it. Any guidance would be appreciated.

Sadly, I don’t know where a mac stores the settings files for Luban. However, quickly looking up the equivalent seems to be ~/Library/Application Support/ and the snapmaker luban folder should be in there.

Howdy smart people,

Any chance chance @Skreelink or anybody else knows how to send a folder containing G-code to the snapmaker via drag and drop method? Not to run immediately, but to put on the device storage for me to start manually.

This would be handy for organization when I’ve got a bunch of projects on the queue!

A tip for those using this drag and drop method:

Do not include any special characters in your file name. I was stumped with a file that I couldn’t send wirelessly to my Snapmaker, until I realized it’s because I had a comma in the file name. Even though your computer’s file management system can handle it, apparently curl doesn’t appreciate it.
So if you’re getting the error: “curl: (26) Failed to open/read local data from file/application
Check your file name.

This is likely an obvious issue for those with more experience, but I wanted to share for those just fooling around - such as myself.

Cheers!

1 Like

First, thank you so much for all your guides, I have found them VERY helpful! I wanted to add just a couple of notes:

I ran into the same issue with the comments, but when I removed the space before the semi-colon, it worked. So this would fail/skip:
G28 ; Safety home, incase you forgot after power on.

But this would run:
G28; Safety home, incase you forgot after power on.

Also, I am on a Mac, so the machine.json path was ‘/Users/Parker/Library/Application Support/snapmaker-luban/machine.json’ for me. Since Macs can’t run bash, I made a shell script that does the same thing, but will also pull in the token and IP address directly from machine.json if it is there. I called it “laser_print.sh” and I have it saved on my desktop. Make sure to make it executable (chmod +x laser_print.sh) and optionally can add it to your bin to call from anywhere (sudo cp -pv laser_print.sh /usr/local/bin/laser_print). Make sure to change the [TOKEN] and [IP] in the shell script to your default ones. It will use the ones you set if it can’t get it from machine.json. You can call this via the terminal and pass in the filename to run, drag and drop a file on it, or make a Quick Action to right click on a file and send it over.

laser_print_template.sh.zip (2.1 KB)

3 Likes