mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Use context to evaluate materialDiameter
This commit is contained in:
parent
7216641fad
commit
a2c2282b44
1 changed files with 4 additions and 9 deletions
|
@ -10,10 +10,9 @@ from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase
|
||||||
from UM.Settings.ContainerStack import ContainerStack
|
from UM.Settings.ContainerStack import ContainerStack
|
||||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
from UM.Settings.Interfaces import ContainerInterface, PropertyEvaluationContext
|
from UM.Settings.Interfaces import ContainerInterface, PropertyEvaluationContext
|
||||||
from UM.Settings.SettingInstance import SettingInstance
|
|
||||||
|
|
||||||
from . import Exceptions
|
from . import Exceptions
|
||||||
from .CuraContainerStack import CuraContainerStack
|
from .CuraContainerStack import CuraContainerStack, _ContainerIndexes
|
||||||
from .ExtruderManager import ExtruderManager
|
from .ExtruderManager import ExtruderManager
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
@ -57,14 +56,10 @@ class ExtruderStack(CuraContainerStack):
|
||||||
# \return The filament diameter for the printer
|
# \return The filament diameter for the printer
|
||||||
@property
|
@property
|
||||||
def materialDiameter(self) -> float:
|
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:
|
return self.getProperty("material_diameter", "value", context = context)
|
||||||
if container is not None:
|
|
||||||
material_diameter = container.getProperty("material_diameter", "value")
|
|
||||||
if material_diameter is not None:
|
|
||||||
return material_diameter
|
|
||||||
return -1
|
|
||||||
|
|
||||||
## Return the approximate filament diameter that the machine requires.
|
## Return the approximate filament diameter that the machine requires.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue