mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
CURA-4946 When storing the gcode profile, the definition must be the
quality definition if the printer has_machine_quality. Otherwise the fdmprinter definition must be used as a fallback. If there is no quality_definition then the printer definition is use.
This commit is contained in:
parent
6a4f519238
commit
6af5a5d4bc
2 changed files with 19 additions and 1 deletions
|
@ -237,7 +237,7 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||
if expected_machine_definition is not None and profile_definition is not None and profile_definition != expected_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> doesn't match with your current machine, could not import it.", file_name)}
|
||||
"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)}
|
||||
|
||||
name_seed = os.path.splitext(os.path.basename(file_name))[0]
|
||||
new_name = self.uniqueName(name_seed)
|
||||
|
|
|
@ -5,6 +5,7 @@ from UM.Mesh.MeshWriter import MeshWriter
|
|||
from UM.Logger import Logger
|
||||
from UM.Application import Application
|
||||
from UM.Settings.InstanceContainer import InstanceContainer
|
||||
from UM.Util import parseBool
|
||||
|
||||
from cura.Settings.ExtruderManager import ExtruderManager
|
||||
|
||||
|
@ -120,6 +121,14 @@ class GCodeWriter(MeshWriter):
|
|||
if flat_global_container.getMetaDataEntry("quality_type", None) is None:
|
||||
flat_global_container.addMetaDataEntry("quality_type", stack.quality.getMetaDataEntry("quality_type", "normal"))
|
||||
|
||||
# Change the default defintion
|
||||
default_machine_definition = "fdmprinter"
|
||||
if parseBool(stack.getMetaDataEntry("has_machine_quality", "False")):
|
||||
default_machine_definition = stack.getMetaDataEntry("quality_definition")
|
||||
if not default_machine_definition:
|
||||
default_machine_definition = stack.definition.getId()
|
||||
flat_global_container.setMetaDataEntry("definition", default_machine_definition)
|
||||
|
||||
serialized = flat_global_container.serialize()
|
||||
data = {"global_quality": serialized}
|
||||
|
||||
|
@ -140,6 +149,15 @@ class GCodeWriter(MeshWriter):
|
|||
# Ensure that quality_type is set. (Can happen if we have empty quality changes).
|
||||
if flat_extruder_quality.getMetaDataEntry("quality_type", None) is None:
|
||||
flat_extruder_quality.addMetaDataEntry("quality_type", extruder.quality.getMetaDataEntry("quality_type", "normal"))
|
||||
|
||||
# Change the default defintion
|
||||
default_extruder_definition = "fdmextruder"
|
||||
if parseBool(stack.getMetaDataEntry("has_machine_quality", "False")):
|
||||
default_extruder_definition = extruder.getMetaDataEntry("quality_definition")
|
||||
if not default_extruder_definition:
|
||||
default_extruder_definition = extruder.definition.getId()
|
||||
flat_extruder_quality.setMetaDataEntry("definition", default_extruder_definition)
|
||||
|
||||
extruder_serialized = flat_extruder_quality.serialize()
|
||||
data.setdefault("extruder_quality", []).append(extruder_serialized)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue