mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -06:00
Do not add and register Extruders if they are already there
CURA-3756
This commit is contained in:
parent
739fd2bbcb
commit
b2f0623ecf
2 changed files with 11 additions and 0 deletions
|
@ -237,6 +237,13 @@ class ExtruderManager(QObject):
|
||||||
if machine_id not in self._extruder_trains:
|
if machine_id not in self._extruder_trains:
|
||||||
self._extruder_trains[machine_id] = {}
|
self._extruder_trains[machine_id] = {}
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
|
# do not register if an extruder has already been registered at the position on this machine
|
||||||
|
if any(item.getId() == extruder_train.getId() for item in self._extruder_trains[machine_id].values()):
|
||||||
|
Logger.log("w", "Extruder [%s] has already been registered on machine [%s], not doing anything",
|
||||||
|
extruder_train.getId(), machine_id)
|
||||||
|
return
|
||||||
|
|
||||||
if extruder_train:
|
if extruder_train:
|
||||||
self._extruder_trains[machine_id][extruder_train.getMetaDataEntry("position")] = extruder_train
|
self._extruder_trains[machine_id][extruder_train.getMetaDataEntry("position")] = extruder_train
|
||||||
changed = True
|
changed = True
|
||||||
|
|
|
@ -52,12 +52,16 @@ class GlobalStack(CuraContainerStack):
|
||||||
extruder_count = self.getProperty("machine_extruder_count", "value")
|
extruder_count = self.getProperty("machine_extruder_count", "value")
|
||||||
if extruder_count and len(self._extruders) + 1 > extruder_count:
|
if extruder_count and len(self._extruders) + 1 > extruder_count:
|
||||||
Logger.log("w", "Adding extruder {meta} to {id} but its extruder count is {count}".format(id = self.id, count = extruder_count, meta = str(extruder.getMetaData())))
|
Logger.log("w", "Adding extruder {meta} to {id} but its extruder count is {count}".format(id = self.id, count = extruder_count, meta = str(extruder.getMetaData())))
|
||||||
|
return
|
||||||
|
|
||||||
position = extruder.getMetaDataEntry("position")
|
position = extruder.getMetaDataEntry("position")
|
||||||
if position is None:
|
if position is None:
|
||||||
Logger.log("w", "No position defined for extruder {extruder}, cannot add it to stack {stack}", extruder = extruder.id, stack = self.id)
|
Logger.log("w", "No position defined for extruder {extruder}, cannot add it to stack {stack}", extruder = extruder.id, stack = self.id)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if any(item.getId() == extruder.id for item in self._extruders.values()):
|
||||||
|
Logger.log("w", "Extruder [%s] has already been added to this stack [%s]", extruder.id, self._id)
|
||||||
|
return
|
||||||
self._extruders[position] = extruder
|
self._extruders[position] = extruder
|
||||||
|
|
||||||
## Overridden from ContainerStack
|
## Overridden from ContainerStack
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue