A few more I made.
If you’re doing batch production and just want to keep repeating the same thing, you can simply send the start print code again via a bat file. I saved it as RestartPrint.bat
@echo off
curl -X POST "http://[IP HERE]:8080/api/v1/connect?token=[TOKEN HERE]"
curl -X POST "http://[IP HERE]:8080/api/v1/start_print?token=[TOKEN HERE]"
Same if you want to stop it if something goes wrong and you’re not close to the machine, named unironically StopPrint.bat
@echo off
curl -X POST "http://[IP HERE]:8080/api/v1/connect?token=[TOKEN HERE]"
curl -X POST "http://[IP HERE]:8080/api/v1/stop_print?token=[TOKEN HERE]"
A fun one, if you want to send lines of code yourself (basically the console
in Luban). I named mine SendCode.bat
It will continue to ask for the next command until you close the window.
@echo off
:a
set /p code=gcode to send:
curl -X POST "http://[IP HERE]:8080/api/v1/connect?token=[TOKEN HERE]"
curl -X POST "http://[IP HERE]:8080/api/v1/execute_code?token=[TOKEN HERE]&code=%code%"
goto :a
Keep in mind the letters in the gcode have to be capitals. i.e. G28
and not g28
and either send it with no spaces G0Y100
or with underscores G0_Y00
. This works with the snapmaker specific MXXXX
codes as well, such as M2000
for system inquiry. This is how the console in Luban works, anything you input is sent as a web API using the above URL. Just more on my endeavor to not use Luban at all.