mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Added setting sending per extruder
CURA-1681
This commit is contained in:
parent
b6649eab3a
commit
d93044a338
3 changed files with 20 additions and 8 deletions
|
@ -187,19 +187,18 @@ class ExtruderManager(QObject):
|
||||||
|
|
||||||
container_registry.addContainer(container_stack)
|
container_registry.addContainer(container_stack)
|
||||||
|
|
||||||
## Generates extruders for a specific machine.
|
## Gets extruders for a specific machine.
|
||||||
def getMachineExtruders(self, machine_definition):
|
def getMachineExtruders(self, machine_definition_id):
|
||||||
container_registry = UM.Settings.ContainerRegistry.getInstance()
|
container_registry = UM.Settings.ContainerRegistry.getInstance()
|
||||||
machine_id = machine_definition.getId()
|
if not machine_definition_id in self._extruder_trains:
|
||||||
if not machine_id in self._extruder_trains:
|
UM.Logger.log("w", "Tried to get the extruder trains for machine %s, which doesn't exist.", machine_definition_id)
|
||||||
UM.Logger.log("w", "Tried to get the extruder trains for machine %s, which doesn't exist.", machine_id)
|
|
||||||
return
|
return
|
||||||
for _,extruder_train_id in self._extruder_trains[machine_id].items():
|
for _,extruder_train_id in self._extruder_trains[machine_definition_id].items():
|
||||||
extruder_train = container_registry.findContainerStacks(id = extruder_train_id)
|
extruder_train = container_registry.findContainerStacks(id = extruder_train_id)
|
||||||
if extruder_train:
|
if extruder_train:
|
||||||
yield extruder_train[0]
|
yield extruder_train[0]
|
||||||
else:
|
else:
|
||||||
UM.Logger.log("w", "Machine %s refers to an extruder train with ID %s, which doesn't exist.", machine_id, extruder_train_id)
|
UM.Logger.log("w", "Machine %s refers to an extruder train with ID %s, which doesn't exist.", machine_definition_id, extruder_train_id)
|
||||||
|
|
||||||
## Adds the extruders of the currently active machine.
|
## Adds the extruders of the currently active machine.
|
||||||
def _addCurrentMachineExtruders(self):
|
def _addCurrentMachineExtruders(self):
|
||||||
|
|
|
@ -51,7 +51,7 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
||||||
global_container_stack = UM.Application.getInstance().getGlobalContainerStack()
|
global_container_stack = UM.Application.getInstance().getGlobalContainerStack()
|
||||||
if not global_container_stack:
|
if not global_container_stack:
|
||||||
return #There is no machine to get the extruders of.
|
return #There is no machine to get the extruders of.
|
||||||
for index, extruder in enumerate(manager.getMachineExtruders(global_container_stack.getBottom())):
|
for index, extruder in enumerate(manager.getMachineExtruders(global_container_stack.getBottom().getId())):
|
||||||
material = extruder.findContainer({ "type": "material" })
|
material = extruder.findContainer({ "type": "material" })
|
||||||
colour = material.getMetaDataEntry("color_code", default = "#FFFF00") if material else "#FFFF00"
|
colour = material.getMetaDataEntry("color_code", default = "#FFFF00") if material else "#FFFF00"
|
||||||
item = { #Construct an item with only the relevant information.
|
item = { #Construct an item with only the relevant information.
|
||||||
|
|
|
@ -15,6 +15,7 @@ from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
||||||
from UM.Settings.Validator import ValidatorState
|
from UM.Settings.Validator import ValidatorState
|
||||||
|
|
||||||
from cura.OneAtATimeIterator import OneAtATimeIterator
|
from cura.OneAtATimeIterator import OneAtATimeIterator
|
||||||
|
from cura.ExtruderManager import ExtruderManager
|
||||||
|
|
||||||
class StartJobResult(IntEnum):
|
class StartJobResult(IntEnum):
|
||||||
Finished = 1
|
Finished = 1
|
||||||
|
@ -127,6 +128,9 @@ class StartSliceJob(Job):
|
||||||
|
|
||||||
self._buildGlobalSettingsMessage(stack)
|
self._buildGlobalSettingsMessage(stack)
|
||||||
|
|
||||||
|
for extruder_stack in ExtruderManager.getInstance().getMachineExtruders(stack.getBottom().getId()):
|
||||||
|
self._buildExtruderMessage(extruder_stack)
|
||||||
|
|
||||||
for group in object_groups:
|
for group in object_groups:
|
||||||
group_message = self._slice_message.addRepeatedMessage("object_lists")
|
group_message = self._slice_message.addRepeatedMessage("object_lists")
|
||||||
if group[0].getParent().callDecoration("isGroup"):
|
if group[0].getParent().callDecoration("isGroup"):
|
||||||
|
@ -166,6 +170,15 @@ class StartSliceJob(Job):
|
||||||
Logger.logException("w", "Unable to do token replacement on start/end gcode")
|
Logger.logException("w", "Unable to do token replacement on start/end gcode")
|
||||||
return str(value).encode("utf-8")
|
return str(value).encode("utf-8")
|
||||||
|
|
||||||
|
def _buildExtruderMessage(self, stack):
|
||||||
|
message = self._slice_message.addRepeatedMessage("extruders")
|
||||||
|
message.id = int(stack.getMetaDataEntry("position"))
|
||||||
|
for key in stack.getAllKeys():
|
||||||
|
setting = message.addRepeatedMessage("settings")
|
||||||
|
setting.name = key
|
||||||
|
setting.value = str(stack.getProperty(key, "value")).encode("utf-8")
|
||||||
|
Job.yieldThread()
|
||||||
|
|
||||||
## Sends all global settings to the engine.
|
## Sends all global settings to the engine.
|
||||||
#
|
#
|
||||||
# The settings are taken from the global stack. This does not include any
|
# The settings are taken from the global stack. This does not include any
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue