mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 16:27:51 -06:00
Fix possibly wrong returned initial extruder
CURA-12099
This commit is contained in:
parent
afc22638ba
commit
c28ab219a0
1 changed files with 8 additions and 3 deletions
|
@ -15,6 +15,7 @@ from UM.Scene.Selection import Selection
|
||||||
from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator
|
from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator
|
||||||
from UM.Settings.ContainerRegistry import ContainerRegistry # Finding containers by ID.
|
from UM.Settings.ContainerRegistry import ContainerRegistry # Finding containers by ID.
|
||||||
from cura.Machines.ContainerTree import ContainerTree
|
from cura.Machines.ContainerTree import ContainerTree
|
||||||
|
from cura.Settings.ExtruderStack import ExtruderStack
|
||||||
|
|
||||||
from typing import Any, cast, Dict, List, Optional, TYPE_CHECKING, Union
|
from typing import Any, cast, Dict, List, Optional, TYPE_CHECKING, Union
|
||||||
|
|
||||||
|
@ -304,6 +305,11 @@ class ExtruderManager(QObject):
|
||||||
Logger.log("e", "Unable to find one or more of the extruders in %s", used_extruder_stack_ids)
|
Logger.log("e", "Unable to find one or more of the extruders in %s", used_extruder_stack_ids)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
def getFirstUsedExtruderStack(self)-> ExtruderStack:
|
||||||
|
used_extruders = self.getUsedExtruderStacks()
|
||||||
|
sorted_extruders = sorted(used_extruders, key=lambda extruder: extruder.getValue("extruder_nr"))
|
||||||
|
return sorted_extruders[0]
|
||||||
|
|
||||||
def getInitialExtruderNr(self) -> int:
|
def getInitialExtruderNr(self) -> int:
|
||||||
"""Get the extruder that the print will start with.
|
"""Get the extruder that the print will start with.
|
||||||
|
|
||||||
|
@ -320,8 +326,7 @@ class ExtruderManager(QObject):
|
||||||
skirt_brim_extruder_nr = global_stack.getProperty("skirt_brim_extruder_nr", "value")
|
skirt_brim_extruder_nr = global_stack.getProperty("skirt_brim_extruder_nr", "value")
|
||||||
# if the skirt_brim_extruder_nr is -1, then we use the first used extruder
|
# if the skirt_brim_extruder_nr is -1, then we use the first used extruder
|
||||||
if skirt_brim_extruder_nr == -1:
|
if skirt_brim_extruder_nr == -1:
|
||||||
used_extruders = self.getUsedExtruderStacks()
|
return self.getFirstUsedExtruderStack().getValue("extruder_nr")
|
||||||
return used_extruders[0].position
|
|
||||||
else:
|
else:
|
||||||
return skirt_brim_extruder_nr
|
return skirt_brim_extruder_nr
|
||||||
if adhesion_type == "raft":
|
if adhesion_type == "raft":
|
||||||
|
@ -332,7 +337,7 @@ class ExtruderManager(QObject):
|
||||||
return global_stack.getProperty("support_infill_extruder_nr", "value")
|
return global_stack.getProperty("support_infill_extruder_nr", "value")
|
||||||
|
|
||||||
# REALLY no adhesion? Use the first used extruder.
|
# REALLY no adhesion? Use the first used extruder.
|
||||||
return self.getUsedExtruderStacks()[0].getProperty("extruder_nr", "value")
|
return self.getFirstUsedExtruderStack().getValue("extruder_nr")
|
||||||
|
|
||||||
def removeMachineExtruders(self, machine_id: str) -> None:
|
def removeMachineExtruders(self, machine_id: str) -> None:
|
||||||
"""Removes the container stack and user profile for the extruders for a specific machine.
|
"""Removes the container stack and user profile for the extruders for a specific machine.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue