mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 15:07:28 -06:00
Catch an error getting an extruder value before extruders are added to the global stack
This commit is contained in:
parent
66c3cc9204
commit
b671a3153a
1 changed files with 6 additions and 1 deletions
|
@ -5,6 +5,7 @@ from typing import Any, List, Optional, TYPE_CHECKING
|
||||||
|
|
||||||
from UM.Settings.PropertyEvaluationContext import PropertyEvaluationContext
|
from UM.Settings.PropertyEvaluationContext import PropertyEvaluationContext
|
||||||
from UM.Settings.SettingFunction import SettingFunction
|
from UM.Settings.SettingFunction import SettingFunction
|
||||||
|
from UM.Logger import Logger
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from cura.CuraApplication import CuraApplication
|
from cura.CuraApplication import CuraApplication
|
||||||
|
@ -38,7 +39,11 @@ class CuraFormulaFunctions:
|
||||||
extruder_position = int(machine_manager.defaultExtruderPosition)
|
extruder_position = int(machine_manager.defaultExtruderPosition)
|
||||||
|
|
||||||
global_stack = machine_manager.activeMachine
|
global_stack = machine_manager.activeMachine
|
||||||
extruder_stack = global_stack.extruders[str(extruder_position)]
|
try:
|
||||||
|
extruder_stack = global_stack.extruders[str(extruder_position)]
|
||||||
|
except KeyError:
|
||||||
|
Logger.log("w", "Value for %s of extruder %s was requested, but that extruder is not available" % (property_key, extruder_position))
|
||||||
|
return None
|
||||||
|
|
||||||
value = extruder_stack.getRawProperty(property_key, "value", context = context)
|
value = extruder_stack.getRawProperty(property_key, "value", context = context)
|
||||||
if isinstance(value, SettingFunction):
|
if isinstance(value, SettingFunction):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue