file_manager: Added per tool weights and total filament change count metadata
Signed-off-by: Tyler Wondrasek <wondro18@hotmail.com>
This commit is contained in:
parent
9b4b3def44
commit
4889a2dd38
@ -282,7 +282,9 @@ GET /server/files/metadata?filename=tools/drill.gcode
|
|||||||
| `filament_temps` | [int] | List of base temperatures for filaments, in Celsius. |
|
| `filament_temps` | [int] | List of base temperatures for filaments, in Celsius. |
|
||||||
| `filament_type` | string | The type(s) of filament used, ie: `PLA`. |
|
| `filament_type` | string | The type(s) of filament used, ie: `PLA`. |
|
||||||
| `filament_total` | float | The total length filament used in mm. |
|
| `filament_total` | float | The total length filament used in mm. |
|
||||||
|
| `filament_change_count` | int | The number of filament changes in the print. |
|
||||||
| `filament_weight_total` | float | The total weight of filament used in grams. |
|
| `filament_weight_total` | float | The total weight of filament used in grams. |
|
||||||
|
| `filament_weights` | [float] | List of weights in grams used by each tool in the print. |
|
||||||
| `mmu_print` | int | Identifies a multimaterial print with single extruder. |
|
| `mmu_print` | int | Identifies a multimaterial print with single extruder. |
|
||||||
| `referenced_tools` | [int] | List of tool numbers used in the print. |
|
| `referenced_tools` | [int] | List of tool numbers used in the print. |
|
||||||
| `thumbnails` | [object] | A list of `Thumbnail Info` objects. |
|
| `thumbnails` | [object] | A list of `Thumbnail Info` objects. |
|
||||||
|
@ -207,6 +207,9 @@ class BaseSlicer(object):
|
|||||||
def parse_filament_weight_total(self) -> Optional[float]:
|
def parse_filament_weight_total(self) -> Optional[float]:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def parse_filament_weights(self) -> Optional[List[float]]:
|
||||||
|
return None
|
||||||
|
|
||||||
def parse_filament_name(self) -> Optional[str]:
|
def parse_filament_name(self) -> Optional[str]:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -240,6 +243,9 @@ class BaseSlicer(object):
|
|||||||
def parse_first_layer_extr_temp(self) -> Optional[float]:
|
def parse_first_layer_extr_temp(self) -> Optional[float]:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def parse_filament_change_count(self) -> Optional[int]:
|
||||||
|
return None
|
||||||
|
|
||||||
def parse_thumbnails(self) -> Optional[List[Dict[str, Any]]]:
|
def parse_thumbnails(self) -> Optional[List[Dict[str, Any]]]:
|
||||||
for data in [self.header_data, self.footer_data]:
|
for data in [self.header_data, self.footer_data]:
|
||||||
thumb_matches: List[str] = re.findall(
|
thumb_matches: List[str] = re.findall(
|
||||||
@ -404,6 +410,16 @@ class PrusaSlicer(BaseSlicer):
|
|||||||
self.footer_data
|
self.footer_data
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def parse_filament_weights(self) -> Optional[List[float]]:
|
||||||
|
line = regex_find_string(r'filament\sused\s\[g\]\s=\s(%S)\n', self.footer_data)
|
||||||
|
if line:
|
||||||
|
weights = regex_find_floats(
|
||||||
|
r"(%F)", line
|
||||||
|
)
|
||||||
|
if weights:
|
||||||
|
return weights
|
||||||
|
return None
|
||||||
|
|
||||||
def parse_filament_type(self) -> Optional[str]:
|
def parse_filament_type(self) -> Optional[str]:
|
||||||
return regex_find_string(
|
return regex_find_string(
|
||||||
r";\sfilament_type\s=\s(%S)", self.footer_data
|
r";\sfilament_type\s=\s(%S)", self.footer_data
|
||||||
@ -488,6 +504,9 @@ class PrusaSlicer(BaseSlicer):
|
|||||||
def parse_layer_count(self) -> Optional[int]:
|
def parse_layer_count(self) -> Optional[int]:
|
||||||
return regex_find_int(r"; total layers count = (%D)", self.footer_data)
|
return regex_find_int(r"; total layers count = (%D)", self.footer_data)
|
||||||
|
|
||||||
|
def parse_filament_change_count(self) -> Optional[int]:
|
||||||
|
return regex_find_int(r"; total filament change = (%D)", self.footer_data)
|
||||||
|
|
||||||
class Slic3rPE(PrusaSlicer):
|
class Slic3rPE(PrusaSlicer):
|
||||||
def check_identity(self, data: str) -> bool:
|
def check_identity(self, data: str) -> bool:
|
||||||
match = re.search(r"Slic3r\sPrusa\sEdition\s(.*)\son", data)
|
match = re.search(r"Slic3r\sPrusa\sEdition\s(.*)\son", data)
|
||||||
@ -999,12 +1018,14 @@ SUPPORTED_DATA = [
|
|||||||
'filament_name',
|
'filament_name',
|
||||||
'filament_type',
|
'filament_type',
|
||||||
'filament_colors',
|
'filament_colors',
|
||||||
|
'filament_change_count',
|
||||||
'extruder_colors',
|
'extruder_colors',
|
||||||
'filament_temps',
|
'filament_temps',
|
||||||
'referenced_tools',
|
'referenced_tools',
|
||||||
'mmu_print',
|
'mmu_print',
|
||||||
'filament_total',
|
'filament_total',
|
||||||
'filament_weight_total',
|
'filament_weight_total',
|
||||||
|
'filament_weights',
|
||||||
'thumbnails'
|
'thumbnails'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user