mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 20:57:49 -06:00
Expose an extruderValue() function to value functions
It can be used to get the value of a specific extruder Contributes to CURA-2009
This commit is contained in:
parent
a7187e7fe3
commit
791d51df2a
1 changed files with 17 additions and 4 deletions
|
@ -313,10 +313,23 @@ class ExtruderManager(QObject):
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
## Get the value for a setting from a specific extruder.
|
||||||
|
#
|
||||||
|
# This is exposed to SettingFunction to use in value functions.
|
||||||
|
#
|
||||||
|
# \param extruder_index The index of the extruder to get the value from.
|
||||||
|
# \param key The key of the setting to get the value of.
|
||||||
|
#
|
||||||
|
# \return The value of the setting for the specified extruder or None if not found.
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getExtruderValue(extruder_index, name):
|
def getExtruderValue(extruder_index, key):
|
||||||
extruder = ExtruderManager.getInstance().getExtruderStack(extruder_index)
|
extruder = ExtruderManager.getInstance().getExtruderStack(extruder_index)
|
||||||
if extruder:
|
value = None
|
||||||
return extruder.getRawProperty(name, "value", use_next = False)
|
|
||||||
|
|
||||||
return None
|
if extruder:
|
||||||
|
value = extruder.getRawProperty(key, "value", use_next = False)
|
||||||
|
|
||||||
|
if isinstance(value, UM.Settings.SettingFunction):
|
||||||
|
value = value(extruder)
|
||||||
|
|
||||||
|
return value
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue