mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-18 20:28:01 -06:00
Expose an extruderValues() function to value functions
It returns a list of values for all extruders so that things like max() work. Contributes to CURA-2009
This commit is contained in:
parent
f568014e67
commit
b102a6cedd
2 changed files with 24 additions and 1 deletions
|
@ -273,3 +273,25 @@ class ExtruderManager(QObject):
|
|||
global_stack = UM.Application.getInstance().getGlobalContainerStack()
|
||||
if global_stack and global_stack.getBottom():
|
||||
self.addMachineExtruders(global_stack.getBottom(), global_stack.getId())
|
||||
|
||||
@staticmethod
|
||||
def getExtruderValues(name):
|
||||
global_stack = UM.Application.getInstance().getGlobalContainerStack()
|
||||
|
||||
result = []
|
||||
for extruder in ExtruderManager.getInstance().getMachineExtruders(global_stack.getId()):
|
||||
value = extruder.getRawProperty(name, "value", use_next = False)
|
||||
|
||||
if not value:
|
||||
continue
|
||||
|
||||
if isinstance(value, UM.Settings.SettingFunction):
|
||||
value = value(extruder)
|
||||
|
||||
result.append(value)
|
||||
|
||||
if not result:
|
||||
result.append(global_stack.getProperty(name, "value"))
|
||||
|
||||
return result
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue