mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-22 06:03:57 -06:00
Fix checking if an extruder train already exists
Contributes to issues CURA-340 and CURA-1278.
This commit is contained in:
parent
a9376cffd1
commit
499a0557bd
1 changed files with 6 additions and 9 deletions
|
@ -65,15 +65,12 @@ class ExtruderManager(QObject):
|
||||||
return
|
return
|
||||||
|
|
||||||
#Add the extruder trains that don't exist yet.
|
#Add the extruder trains that don't exist yet.
|
||||||
for position, extruder_definition_id in machine_definition.getMetaDataEntry("machine_extruder_trains", default = {}).items():
|
for extruder_definition in container_registry.findDefinitionContainers(machine = machine_definition.getId()):
|
||||||
extruder_definition = container_registry.findDefinitionContainers(machine = machine_definition.getId())
|
position = extruder_definition.getMetaDataEntry("position", None)
|
||||||
if extruder_definition:
|
if not position:
|
||||||
extruder_definition = extruder_definition[0]
|
UM.Logger.Log("w", "Extruder definition %s specifies no position metadata entry.", extruder_definition.getId())
|
||||||
else:
|
if not container_registry.findContainerStacks(machine = machine_id, position = position): #Doesn't exist yet.
|
||||||
UM.Logger.log("w", "Machine %s references an extruder with ID %s, which doesn't exist.", machine_definition.getName(), extruder_definition_id)
|
name = container_registry.uniqueName(extruder_definition.getId()) #Make a name based on the ID of the definition.
|
||||||
continue
|
|
||||||
name = container_registry.uniqueName(extruder_definition_id) #Make a name based on the ID of the definition.
|
|
||||||
if not container_registry.findContainerStacks(id = name): #Doesn't exist yet.
|
|
||||||
self.createExtruderTrain(extruder_definition, machine_definition, name, position)
|
self.createExtruderTrain(extruder_definition, machine_definition, name, position)
|
||||||
|
|
||||||
#Gets the extruder trains that we just created as well as any that still existed.
|
#Gets the extruder trains that we just created as well as any that still existed.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue