Skip to content

Commit

Permalink
add functions for skipping and getting skipped objects
Browse files Browse the repository at this point in the history
  • Loading branch information
ohmdelta committed Oct 17, 2024
1 parent 087aa8d commit 8d1a18c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
23 changes: 23 additions & 0 deletions bambulabs_api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,3 +456,26 @@ def get_current_state(self) -> PrintStatus:
The current state of the printer.
"""
return self.__printerMQTTClient.get_current_state()

def get_skipped_objects(self) -> list[int]:
"""
Get the current state of the printer.
Returns
-------
PrintStatus
The current state of the printer.
"""
return self.__printerMQTTClient.get_skipped_objects()

def skip_objects(self, obj_list: list[int]) -> bool:
"""
Skip Objects during printing.
Args:
obj_list (list[int]): object list to skip objects.
Returns:
bool: if publish command is successful
"""
return self.__printerMQTTClient.skip_objects(obj_list=obj_list)
30 changes: 30 additions & 0 deletions bambulabs_api/mqtt_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,36 @@ def start_print_3mf(self, filename: str,
}
})

def skip_objects(self, obj_list: list[int]) -> bool:
"""
Skip Objects during printing.
Args:
obj_list (list[int]): object list to skip objects.
Returns:
bool: if publish command is successful
"""
return self.__publish_command(
{
"print":
{
"command": "skip_objects",
"obj_list": obj_list,
}
})

def get_skipped_objects(self) -> list[int]:
"""
Get skipped Objects.
Args:
Returns:
bool: if publish command is successful
"""
return self.__get("s_obj", [])

def get_current_state(self) -> PrintStatus:
"""
Get the current printer state from stg_cur
Expand Down

0 comments on commit 8d1a18c

Please sign in to comment.