mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-20 20:59:48 +08:00
Use context to evaluate materialDiameter
This commit is contained in:
parent
7216641fad
commit
a2c2282b44
@ -10,10 +10,9 @@ from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase
|
||||
from UM.Settings.ContainerStack import ContainerStack
|
||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||
from UM.Settings.Interfaces import ContainerInterface, PropertyEvaluationContext
|
||||
from UM.Settings.SettingInstance import SettingInstance
|
||||
|
||||
from . import Exceptions
|
||||
from .CuraContainerStack import CuraContainerStack
|
||||
from .CuraContainerStack import CuraContainerStack, _ContainerIndexes
|
||||
from .ExtruderManager import ExtruderManager
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -57,14 +56,10 @@ class ExtruderStack(CuraContainerStack):
|
||||
# \return The filament diameter for the printer
|
||||
@property
|
||||
def materialDiameter(self) -> float:
|
||||
containers_to_check = [self.variant, self.definitionChanges, self.definition]
|
||||
context = PropertyEvaluationContext(self)
|
||||
context.context["evaluate_from_container_index"] = _ContainerIndexes.Variant
|
||||
|
||||
for container in containers_to_check:
|
||||
if container is not None:
|
||||
material_diameter = container.getProperty("material_diameter", "value")
|
||||
if material_diameter is not None:
|
||||
return material_diameter
|
||||
return -1
|
||||
return self.getProperty("material_diameter", "value", context = context)
|
||||
|
||||
## Return the approximate filament diameter that the machine requires.
|
||||
#
|
||||
|
Loading…
x
Reference in New Issue
Block a user