Do not add an extruder if it has no position set

Otherwise we get very weird values in the extruders dict

Contributes to CURA-3738
This commit is contained in:
Arjen Hiemstra 2017-05-17 13:45:51 +02:00
parent 63e586ab5b
commit 3b73979a2c

View file

@ -53,7 +53,12 @@ class GlobalStack(CuraContainerStack):
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())))
self._extruders[extruder.getMetaDataEntry("position", "0")] = extruder
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
self._extruders[position] = extruder
## Overridden from ContainerStack
#