mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-06 13:34:01 -06:00
CURA-4946 Handle gcode with wrong quality definition
Some gcode has its quality definition set to, say, UM2 extended, which is _actually_ just UM2 gcode. Thus, we check if the definition in the profile matches the current machine or what it in theory should be, either one being valid. See comments in code for details.
This commit is contained in:
parent
984e6ddd08
commit
05c59ddaa7
1 changed files with 14 additions and 6 deletions
|
@ -212,12 +212,20 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||
return { "status": "error",
|
||||
"message": catalog.i18nc("@info:status Don't translate the XML tags <filename> or <message>!", "This profile <filename>{0}</filename> contains incorrect data, could not import it.", file_name)}
|
||||
profile_definition = global_profile.getMetaDataEntry("definition")
|
||||
expected_machine_definition = "fdmprinter"
|
||||
if parseBool(global_container_stack.getMetaDataEntry("has_machine_quality", "False")):
|
||||
expected_machine_definition = global_container_stack.getMetaDataEntry("quality_definition")
|
||||
if not expected_machine_definition:
|
||||
expected_machine_definition = global_container_stack.definition.getId()
|
||||
if expected_machine_definition is not None and profile_definition is not None and profile_definition != expected_machine_definition:
|
||||
|
||||
# Make sure we have a profile_definition in the file:
|
||||
if profile_definition is None:
|
||||
break
|
||||
|
||||
# Get the expected machine definition.
|
||||
# i.e.: We expect gcode for a UM2 Extended to be defined as normal UM2 gcode...
|
||||
expected_machine_definition = getMachineDefinitionIDForQualitySearch(global_container_stack.definition)
|
||||
|
||||
# ...but that's not always the case for Cura 3.1 and older, so also get the current machine:
|
||||
current_machine_definition = global_container_stack.definition.getId()
|
||||
|
||||
# And check if the profile_definition matches either one (showing error if not):
|
||||
if profile_definition not in (expected_machine_definition, current_machine_definition):
|
||||
Logger.log("e", "Profile [%s] is for machine [%s] but the current active machine is [%s]. Will not import the profile", file_name, profile_definition, expected_machine_definition)
|
||||
return { "status": "error",
|
||||
"message": catalog.i18nc("@info:status Don't translate the XML tags <filename> or <message>!", "The machine defined in profile <filename>{0}</filename> ({1}) doesn't match with your current machine ({2}), could not import it.", file_name, profile_definition, expected_machine_definition)}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue