diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index 24a7ee1ec4..9c45815eb9 100755 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -237,6 +237,13 @@ class ExtruderManager(QObject): if machine_id not in self._extruder_trains: self._extruder_trains[machine_id] = {} 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: self._extruder_trains[machine_id][extruder_train.getMetaDataEntry("position")] = extruder_train changed = True diff --git a/cura/Settings/GlobalStack.py b/cura/Settings/GlobalStack.py index 6278c02aeb..9dfb8523b3 100755 --- a/cura/Settings/GlobalStack.py +++ b/cura/Settings/GlobalStack.py @@ -52,12 +52,16 @@ class GlobalStack(CuraContainerStack): extruder_count = self.getProperty("machine_extruder_count", "value") 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()))) + return position = extruder.getMetaDataEntry("position") 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) 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 ## Overridden from ContainerStack