BambuLabs API
Description
API for accessing information for a printer, including the status of the printer and the status of the print job.
Printer
Client Class for connecting to the Bambulabs 3D printer
- bambulabs_api.Printer.calibrate_printer(self, bed_level: bool = True, motor_noise_calibration: bool = True, vibration_compensation: bool = True) bool
Calibrate the printer.
- Parameters:
bed_level (bool, optional) – Whether to calibrate the bed level, by default True.
motor_noise_calibration (bool, optional) – Whether to calibrate the motor noise, by default True.
vibration_compensation (bool, optional) – Whether to calibrate the vibration compensation, by default True.
- Returns:
True if the printer is calibrated successfully.
- Return type:
bool
- bambulabs_api.Printer.connect(self)
Connect to the printer
- bambulabs_api.Printer.delete_file(self, file_path: str) str
Delete a file from the printer.
- Parameters:
file_path (str) – The path of the file to be deleted.
- Returns:
The path of the deleted file.
- Return type:
str
- bambulabs_api.Printer.disconnect(self)
Disconnect from the printer
- bambulabs_api.Printer.get_bed_temperature(self) float | None
Get the bed temperature of the printer. NOT IMPLEMENTED YET
- Returns:
float – The bed temperature of the printer.
None if the printer is not printing.
- bambulabs_api.Printer.get_camera_frame(self) str
Get the camera frame of the printer.
- Returns:
Base64 encoded image of the camera frame.
- Return type:
str
- bambulabs_api.Printer.get_file_name(self) str
Get the name of the file being printed.
- Returns:
The name of the file being printed.
- Return type:
str
- bambulabs_api.Printer.get_light_state(self) str
Get the state of the printer light.
- Returns:
The state of the printer light.
- Return type:
str
- bambulabs_api.Printer.get_nozzle_temperature(self) float | None
Get the nozzle temperature of the printer. NOT IMPLEMENTED YET
- Returns:
float – The nozzle temperature of the printer.
None if the printer is not printing.
- bambulabs_api.Printer.get_percentage(self) int | str | None
Get the percentage of the print job completed.
- Returns:
int – Percentage of the print job completed.
str – “Unknown” if the percentage is unknown.
None if the printer is not printing.
- bambulabs_api.Printer.get_print_speed(self) int
Get the print speed of the printer.
- Returns:
The print speed of the printer.
- Return type:
int
- bambulabs_api.Printer.get_state(self) str
Get the state of the printer.
- Returns:
The state of the printer.
- Return type:
str
- bambulabs_api.Printer.get_time(self) int | str | None
Get the remaining time of the print job in seconds.
- Returns:
int – Remaining time of the print job in seconds.
str – “Unknown” if the remaining time is unknown.
None if the printer is not printing.
- bambulabs_api.Printer.home_printer(self) bool
Home the printer.
- Returns:
True if the printer is homed successfully.
- Return type:
bool
- bambulabs_api.Printer.load_filament_spool(self) bool
Load the filament spool to the printer.
- Returns:
True if the filament spool is loaded successfully.
- Return type:
bool
- bambulabs_api.Printer.move_z_axis(self, height: int) bool
Move the Z-axis of the printer.
- Parameters:
height (float) – The height for the bed.
- Returns:
True if the Z-axis is moved successfully.
- Return type:
bool
- bambulabs_api.Printer.pause_print(self) bool
Pause the printer from printing.
- Returns:
True if the printer is paused successfully.
- Return type:
bool
- bambulabs_api.Printer.resume_print(self) bool
Resume the printer from printing.
- Returns:
True if the printer is resumed successfully.
- Return type:
bool
- bambulabs_api.Printer.retry_filament_action(self) bool
Retry the filament action.
- Returns:
True if the filament action is retried successfully.
- Return type:
bool
- bambulabs_api.Printer.set_bed_temperature(self, temperature: int) bool
Set the bed temperature of the printer.
- Parameters:
temperature (int) – The temperature to be set.
- Returns:
True if the temperature is set successfully.
- Return type:
bool
- bambulabs_api.Printer.set_filament_printer(self, color: str, filament: str | bambulabs_api.filament_info.AMSFilamentSettings) bool
Set the filament of the printer.
- Parameters:
color (str) – The color of the filament.
filament (str | AMSFilamentSettings) – The filament to be set.
- Returns:
True if the filament is set successfully.
- Return type:
bool
- bambulabs_api.Printer.set_nozzle_temperature(self, temperature: int) bool
Set the nozzle temperature of the printer.
- Parameters:
temperature (int) – The temperature to be set.
- Returns:
True if the temperature is set successfully.
- Return type:
bool
- bambulabs_api.Printer.set_print_speed(self, speed_lvl: int) bool
Set the print speed of the printer.
- Parameters:
speed_lvl (int) – The speed level to be set. 0: Slowest 1: Slow 2: Fast 3: Fastest
- Returns:
True if the speed level is set successfully.
- Return type:
bool
- bambulabs_api.Printer.start_print(self, filename: str, plate_number: int) bool
Start printing a file.
- Parameters:
filename (str) – The name of the file to be printed.
plate_number (int) – The plate number of the file to be printed.
- Returns:
True if the file is printed successfully.
- Return type:
bool
- bambulabs_api.Printer.stop_print(self) bool
Stop the printer from printing.
- Returns:
True if the printer is stopped successfully.
- Return type:
bool
- bambulabs_api.Printer.turn_light_off(self) bool
Turn off the printer light.
- Returns:
True if the light is turned off successfully.
- Return type:
bool
- bambulabs_api.Printer.turn_light_on(self) bool
Turn on the printer light.
- Returns:
True if the light is turned on successfully.
- Return type:
bool
- bambulabs_api.Printer.unload_filament_spool(self) bool
Unload the filament spool from the printer.
- Returns:
True if the filament spool is unloaded successfully.
- Return type:
bool
- bambulabs_api.Printer.upload_file(self, file: BinaryIO, filename: str = 'ftp_upload.gcode') str
Upload a file to the printer.
- Parameters:
file (BinaryIO) – The file to be uploaded.
filename (str, optional) – The name of the file, by default “ftp_upload.gcode”.
- Returns:
The path of the uploaded file.
- Return type:
str