Revert "Fix variant vs nozzle"

This reverts commit cb05f75f6ab754f1f095e1cabd19f7259ed917bf.
This commit is contained in:
fieldOfView 2016-06-16 15:08:45 +02:00
parent 666b1a0263
commit 0893e4b2cc

View File

@ -111,7 +111,7 @@ class ExtruderManager(QObject):
## Creates a container stack for an extruder train. ## Creates a container stack for an extruder train.
# #
# The container stack has an extruder definition at the bottom, which is # The container stack has an extruder definition at the bottom, which is
# linked to a machine definition. Then it has a variant profile, a material # linked to a machine definition. Then it has a nozzle profile, a material
# profile, a quality profile and a user profile, in that order. # profile, a quality profile and a user profile, in that order.
# #
# The resulting container stack is added to the registry. # The resulting container stack is added to the registry.
@ -136,29 +136,29 @@ class ExtruderManager(QObject):
container_stack.addMetaDataEntry("position", position) container_stack.addMetaDataEntry("position", position)
container_stack.addContainer(extruder_definition) container_stack.addContainer(extruder_definition)
#Find the variant to use for this extruder. #Find the nozzle to use for this extruder.
variant = container_registry.getEmptyInstanceContainer() nozzle = container_registry.getEmptyInstanceContainer()
if machine_definition.getMetaDataEntry("has_variants", default = "False") == "True": if machine_definition.getMetaDataEntry("has_nozzles", default = "False") == "True":
#First add any variant. Later, overwrite with preference if the preference is valid. #First add any nozzle. Later, overwrite with preference if the preference is valid.
variants = container_registry.findInstanceContainers(machine = machine_id, type = "variant") nozzles = container_registry.findInstanceContainers(machine = machine_id, type = "nozzle")
if len(variants) >= 1: if len(nozzles) >= 1:
variant = variants[0] nozzle = nozzles[0]
preferred_variant_id = machine_definition.getMetaDataEntry("preferred_variant") preferred_nozzle_id = machine_definition.getMetaDataEntry("preferred_nozzle")
if preferred_variant_id: if preferred_nozzle_id:
preferred_variants = container_registry.findInstanceContainers(id = preferred_variant_id, type = "variant") preferred_nozzles = container_registry.findInstanceContainers(id = preferred_nozzle_id, type = "nozzle")
if len(preferred_variants) >= 1: if len(preferred_nozzles) >= 1:
variant = preferred_variants[0] nozzle = preferred_nozzles[0]
else: else:
UM.Logger.log("w", "The preferred variant \"%s\" of machine %s doesn't exist or is not a variant profile.", preferred_variant_id, machine_id) UM.Logger.log("w", "The preferred nozzle \"%s\" of machine %s doesn't exist or is not a nozzle profile.", preferred_nozzle_id, machine_id)
#And leave it at the default variant. #And leave it at the default nozzle.
container_stack.addContainer(variant) container_stack.addContainer(nozzle)
#Find a material to use for this variant. #Find a material to use for this nozzle.
material = container_registry.getEmptyInstanceContainer() material = container_registry.getEmptyInstanceContainer()
if machine_definition.getMetaDataEntry("has_materials", default = "False") == "True": if machine_definition.getMetaDataEntry("has_materials", default = "False") == "True":
#First add any material. Later, overwrite with preference if the preference is valid. #First add any material. Later, overwrite with preference if the preference is valid.
if machine_definition.getMetaDataEntry("has_variant_materials", default = "False") == "True": if machine_definition.getMetaDataEntry("has_nozzle_materials", default = "False") == "True":
materials = container_registry.findInstanceContainers(type = "material", machine = machine_id, variant = variant.getId()) materials = container_registry.findInstanceContainers(type = "material", machine = machine_id, nozzle = nozzle.getId())
else: else:
materials = container_registry.findInstanceContainers(type = "material", machine = machine_id) materials = container_registry.findInstanceContainers(type = "material", machine = machine_id)
if len(materials) >= 1: if len(materials) >= 1:
@ -175,7 +175,7 @@ class ExtruderManager(QObject):
#Find a quality to use for this extruder. #Find a quality to use for this extruder.
quality = container_registry.getEmptyInstanceContainer() quality = container_registry.getEmptyInstanceContainer()
#First add any quality. Later, overwrite with preference if the preference is valid. #First add any quality. Later, overwrite with preference if the preference is valid.
qualities = container_registry.findInstanceContainers(type = "quality") qualities = container_registry.findInstanceContainers(type = "quality")
if len(qualities) >= 1: if len(qualities) >= 1: