Last active
March 3, 2025 05:49
-
-
Save patrikalienus/549fcf76be41097545fe61da88e4dafe to your computer and use it in GitHub Desktop.
Make Orca Slicer discover your printer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# My computer is on ethernet and the Bambu printer is on WLAN. These two networks can communicate with | |
# eachother, but OrcaSlicer is still not able to discover the printer. This will "trick" Orca into | |
# discovering the printer and connect to its IP. I've tested this extensively and working as expected. | |
# I have full control over the printer that is in LAN only mode. I have to have it in LAN only mode | |
# because I don't want to install their coming update which will decrease the usability of the printer | |
# if you're using Orca - and so many are. | |
# | |
# Change the parameters to fit your environment and run it after launching Orca. | |
import socket | |
from datetime import datetime | |
# Parameters | |
PRINTER_IP = "x.x.x.x" # IP address of your BambuLab Printer | |
TARGET_IP = "x.x.x.x" # IP address of your PC running BambuStudio | |
PRINTER_USN = "000000000000000" # Enter your own Printer Serial Number here | |
# PRINTER_DEV_MODEL: https://github.com/bambulab/BambuStudio/tree/master/resources/printers | |
# X1C : "3DPrinter-X1-Carbon" | |
# X1 : "3DPrinter-X1" | |
# X1E : "C13" | |
# P1P : "C11" | |
# P1S : "C12" | |
# A1 mini: "N1" | |
# A1 : "N2S" | |
PRINTER_DEV_MODEL = "C11" # Set this to your model | |
PRINTER_DEV_NAME = "PRINTER-NAME" # Whatever you want | |
PRINTER_DEV_SIGNAL = "-44" # Good Signal (Artificial) | |
PRINTER_DEV_CONNECT = "lan" # LAN Mode | |
PRINTER_DEV_BIND = "free" # Not bound to a Cloud user-account | |
# Port settings | |
remoteudpport = 2021 # port to send to | |
sourceudpport = 0 # SourcePort, 0 means any available port | |
# Message to send | |
message = ( | |
f"HTTP/1.1 200 OK\r\n" | |
f"Server: Buildroot/2018.02-rc3 UPnP/1.0 ssdpd/1.8\r\n" | |
f"Date: {datetime.now().strftime('%a, %d %b %Y %H:%M:%S GMT')}\r\n" | |
f"Location: {PRINTER_IP}\r\n" | |
f"ST: urn:bambulab-com:device:3dprinter:1\r\n" | |
f"EXT:\r\n" | |
f"USN: {PRINTER_USN}\r\n" | |
f"Cache-Control: max-age=1800\r\n" | |
f"DevModel.bambu.com: {PRINTER_DEV_MODEL}\r\n" | |
f"DevName.bambu.com: {PRINTER_DEV_NAME}\r\n" | |
f"DevSignal.bambu.com: {PRINTER_DEV_SIGNAL}\r\n" | |
f"DevConnect.bambu.com: {PRINTER_DEV_CONNECT}\r\n" | |
f"DevBind.bambu.com: {PRINTER_DEV_BIND}\r\n\r\n" | |
) | |
# Create UDP socket | |
udp_client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
udp_client.bind(('', sourceudpport)) | |
# Send message | |
byte_buffer = message.encode('ascii') | |
udp_client.sendto(byte_buffer, (TARGET_IP, remoteudpport)) | |
# Close the socket | |
udp_client.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@lukaskirner Thanks for this list. I'll update the gist to include the correct names. It wasn't until after I put this gist up that I discovered that even though I could control the printer through OrcaSlicer, I couldn't actually send print jobs, which is weird to me and I assumed it was because of my somewhat complicated network setup and that I'd need to allow specific UDP packets to go to my LAN, which I haven't fiddled with yet. I consider wifi insecure even though I change the WPA2 key relatively often, which is why that network isn't allowed to initiate traffic to the wired LAN.
Yes, it's absolutely ridiculous that it needs an internet connection in order to even function properly. I hope the "new DEV mode" that Bambu is (now) peddling will solve this.