From a747ca0661c3753e5a91eb8192d0bbd172fd8abc Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 28 Sep 2020 11:44:19 +0200 Subject: [PATCH 1/2] Fix filtering of output MIME types removable drive The RemovableDriveOutputDevice was selecting the preferred format to save the slice output in automatically. To select this, it was taking the intersection between the available output formats (for which there is a Writer plug-in) and the file formats that the printer supports. However if the printer supports a file format that is not supported by Cura, it would crash here because it was looking up the plug-in for a MIME type it doesn't know about. Stupid mistake. But not half as stupid as the bug I'm about to fix in the next commit. Fixes #4827. --- .../RemovableDriveOutputDevice/RemovableDriveOutputDevice.py | 2 +- resources/definitions/SV01.def.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py b/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py index 2654914767..ccdd27ef16 100644 --- a/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py +++ b/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py @@ -59,7 +59,7 @@ class RemovableDriveOutputDevice(OutputDevice): # Take the intersection between file_formats and machine_file_formats. format_by_mimetype = {format["mime_type"]: format for format in file_formats} - file_formats = [format_by_mimetype[mimetype] for mimetype in machine_file_formats] #Keep them ordered according to the preference in machine_file_formats. + file_formats = [format_by_mimetype[mimetype] for mimetype in machine_file_formats if mimetype in format_by_mimetype] # Keep them ordered according to the preference in machine_file_formats. if len(file_formats) == 0: Logger.log("e", "There are no file formats available to write with!") diff --git a/resources/definitions/SV01.def.json b/resources/definitions/SV01.def.json index fb410151a9..02347a8e3b 100644 --- a/resources/definitions/SV01.def.json +++ b/resources/definitions/SV01.def.json @@ -14,7 +14,7 @@ "0": "SV01_extruder_0" } }, - + "overrides": { "machine_name": { "default_value": "SV01" }, "machine_extruder_count": { "default_value": 1 }, From c849312ecf1ec8c2e54605aafd1a3299ddb5484b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 28 Sep 2020 11:56:54 +0200 Subject: [PATCH 2/2] Use canonical MIME type for STL files This is the canonical MIME type for STL files since March 2018: https://www.iana.org/assignments/media-types/model/stl There is no longer a difference between the MIME type of binary vs. ASCII STL files now. --- resources/definitions/fdmprinter.def.json | 2 +- resources/definitions/maker_starter.def.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 10bd2efd4a..0089686335 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -7,7 +7,7 @@ "author": "Ultimaker", "manufacturer": "Unknown", "setting_version": 16, - "file_formats": "text/x-gcode;application/x-stl-ascii;application/x-stl-binary;application/x-wavefront-obj;application/x3g", + "file_formats": "text/x-gcode;model/stl;application/x-wavefront-obj;application/x3g", "visible": false, "has_materials": true, "has_variants": false, diff --git a/resources/definitions/maker_starter.def.json b/resources/definitions/maker_starter.def.json index 6687ef25af..d847bd4fe5 100644 --- a/resources/definitions/maker_starter.def.json +++ b/resources/definitions/maker_starter.def.json @@ -6,7 +6,7 @@ "visible": true, "author": "tvlgiao", "manufacturer": "3DMaker", - "file_formats": "text/x-gcode;application/x-stl-ascii;application/x-stl-binary;application/x-wavefront-obj", + "file_formats": "text/x-gcode;model/stl;application/x-wavefront-obj", "platform": "makerstarter_platform.3mf", "preferred_quality_type": "draft", "machine_extruder_trains":