Hi folks,
I’m working on some 3D printing software and I want to automatically print sliced gcode on Bambu printers (at least the X1C, but ideally others as well).
I have FTP upload to the device working, and the gcode file troy-ps-sliced-test-pyramid.gcode
placed in the default FTP upload directory. I can load this file on the touchscreen and print it. Now I want to print it automatically.
I am able to connect via MQTT, read status, and issue commands. For example, these calls using the Mosquitto MQTT command line tools work fine:
# Get status
mosquitto_sub -h 10.1.10.90 --cafile blcert.pem --insecure -u bblp -P REDACTED -t 'device/REDACTED/report'
# Turn the light on
mosquitto_pub -h 10.1.10.90 --cafile blcert.pem --insecure -u bblp -P REDACTED -t 'device/REDACTED/request' -m '{"system":{"sequence_id": "tro_1749319197","command": "ledctrl","led_node":"chamber_light","led_mode":"on","led_on_time": 500,"led_off_time": 500,"loop_times":1,"interval_time": 1000}}' -d
# Home the device
mosquitto_pub -h 10.1.10.90 --cafile blcert.pem --insecure -u bblp -P REDACTED -t 'device/REDACTED/request' -d -m '{"print":{"sequence_id":"2027","command":"gcode_line","param":"G28\n"}}'
I read that there is a command for printing a GCode (not a 3MF) file. Here are two sources that describe this:
https://forum.bambulab.com/t/how-to-send-gcode-command-to-x1c/138797/5
However, I cannot get it to work! I have tried this command
mosquitto_pub -h 10.1.10.90 --cafile blcert.pem --insecure -u bblp -P REDACTED -t 'device/REDACTED/request' -d -m '{"print": {"sequence_id": "1749319460", "command": "gcode_file", "param": "/troy-ps-sliced-test-pyramid.gcode"}}'
And I’ve toyed around with the path (with and without leading slash, adding /data/sdcard, The device is in LAN only mode with developer mode on.
Does anyone have an integration where this is working? Am I missing some parameters that are now required? Any help or tips would be greatly appreciated.
PS I know there may be an option to construct my own sliced 3MF files, and I can do that if I need to, but it’s my preference to just get the gcode print command working if such a command exists.