mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-05 06:14:01 +08:00
Only extend file formats for um3
This was a mistake in the previous implementation. The relevant piece of code was adding ufp support for um3 printers. This is legacy support for this printer since the printer didn't know it supported ufp, but through the digital factory it could support ufp files. However, with the addition of method printers we should have added an additional check where we also check if the printer is an um3. Instead an additional check was added that did the same for makerbot printers. Because of this check didn't have a "is method" check support for makerbot format is also added to s-line printers and legacy um printers. (fyi @saumyaj3) CURA-11377
This commit is contained in:
parent
31976e591f
commit
e66a3cda67
@ -213,7 +213,12 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Export the scene to the correct file type.
|
# Export the scene to the correct file type.
|
||||||
job = ExportFileJob(file_handler=file_handler, nodes=nodes, firmware_version=self.firmwareVersion)
|
job = ExportFileJob(
|
||||||
|
file_handler=file_handler,
|
||||||
|
nodes=nodes,
|
||||||
|
firmware_version=self.firmwareVersion,
|
||||||
|
print_type=self.printerType,
|
||||||
|
)
|
||||||
job.finished.connect(self._onPrintJobCreated)
|
job.finished.connect(self._onPrintJobCreated)
|
||||||
job.start()
|
job.start()
|
||||||
|
|
||||||
|
@ -16,9 +16,9 @@ from .MeshFormatHandler import MeshFormatHandler
|
|||||||
class ExportFileJob(WriteFileJob):
|
class ExportFileJob(WriteFileJob):
|
||||||
"""Job that exports the build plate to the correct file format for the target cluster."""
|
"""Job that exports the build plate to the correct file format for the target cluster."""
|
||||||
|
|
||||||
def __init__(self, file_handler: Optional[FileHandler], nodes: List[SceneNode], firmware_version: str) -> None:
|
def __init__(self, file_handler: Optional[FileHandler], nodes: List[SceneNode], firmware_version: str,
|
||||||
|
print_type: str) -> None:
|
||||||
self._mesh_format_handler = MeshFormatHandler(file_handler, firmware_version)
|
self._mesh_format_handler = MeshFormatHandler(file_handler, firmware_version, print_type)
|
||||||
if not self._mesh_format_handler.is_valid:
|
if not self._mesh_format_handler.is_valid:
|
||||||
Logger.log("e", "Missing file or mesh writer!")
|
Logger.log("e", "Missing file or mesh writer!")
|
||||||
return
|
return
|
||||||
|
@ -19,10 +19,9 @@ I18N_CATALOG = i18nCatalog("cura")
|
|||||||
class MeshFormatHandler:
|
class MeshFormatHandler:
|
||||||
"""This class is responsible for choosing the formats used by the connected clusters."""
|
"""This class is responsible for choosing the formats used by the connected clusters."""
|
||||||
|
|
||||||
|
def __init__(self, file_handler: Optional[FileHandler], firmware_version: str, printer_type: str) -> None:
|
||||||
def __init__(self, file_handler: Optional[FileHandler], firmware_version: str) -> None:
|
|
||||||
self._file_handler = file_handler or CuraApplication.getInstance().getMeshFileHandler()
|
self._file_handler = file_handler or CuraApplication.getInstance().getMeshFileHandler()
|
||||||
self._preferred_format = self._getPreferredFormat(firmware_version)
|
self._preferred_format = self._getPreferredFormat(firmware_version, printer_type)
|
||||||
self._writer = self._getWriter(self.mime_type) if self._preferred_format else None
|
self._writer = self._getWriter(self.mime_type) if self._preferred_format else None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -82,7 +81,7 @@ class MeshFormatHandler:
|
|||||||
value = value.encode()
|
value = value.encode()
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def _getPreferredFormat(self, firmware_version: str) -> Dict[str, Union[str, int, bool]]:
|
def _getPreferredFormat(self, firmware_version: str, printer_type: str) -> Dict[str, Union[str, int, bool]]:
|
||||||
"""Chooses the preferred file format for the given file handler.
|
"""Chooses the preferred file format for the given file handler.
|
||||||
|
|
||||||
:param firmware_version: The version of the firmware.
|
:param firmware_version: The version of the firmware.
|
||||||
@ -103,13 +102,11 @@ class MeshFormatHandler:
|
|||||||
machine_file_formats = [file_type.strip() for file_type in machine_file_formats]
|
machine_file_formats = [file_type.strip() for file_type in machine_file_formats]
|
||||||
|
|
||||||
# Exception for UM3 firmware version >=4.4: UFP is now supported and should be the preferred file format.
|
# Exception for UM3 firmware version >=4.4: UFP is now supported and should be the preferred file format.
|
||||||
if "application/x-ufp" not in machine_file_formats and Version(firmware_version) >= Version("4.4"):
|
if printer_type in (
|
||||||
|
"ultimaker3", "ultimaker3_extended") and "application/x-ufp" not in machine_file_formats and Version(
|
||||||
|
firmware_version) >= Version("4.4"):
|
||||||
machine_file_formats = ["application/x-ufp"] + machine_file_formats
|
machine_file_formats = ["application/x-ufp"] + machine_file_formats
|
||||||
|
|
||||||
# Exception for makerbot firmware version >=2.700: makerbot is supported
|
|
||||||
elif "application/x-makerbot" not in machine_file_formats and Version(firmware_version >= Version("2.700")):
|
|
||||||
machine_file_formats = ["application/x-makerbot"] + machine_file_formats
|
|
||||||
|
|
||||||
# Take the intersection between file_formats and machine_file_formats.
|
# Take the intersection between file_formats and machine_file_formats.
|
||||||
format_by_mimetype = {f["mime_type"]: f for f in file_formats}
|
format_by_mimetype = {f["mime_type"]: f for f in file_formats}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user