mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-10 05:29:02 +08:00
Implement selectIntent
Selects a certain intent profile, applying it to the stack. Contributes to issue CURA-6091.
This commit is contained in:
parent
744fbec38c
commit
aa0bf2f6ba
@ -101,10 +101,21 @@ class IntentManager:
|
||||
def defaultIntent(self) -> InstanceContainer:
|
||||
return CuraApplication.getInstance().empty_intent_container
|
||||
|
||||
def selectIntent(self, intent_category, quality_type):
|
||||
for extruder in all_extruders:
|
||||
extruder_stack.intent = ContainerRegistry.getInstance().findContainers(type = "intent", definition = current_definition_id, variant = extruder_nozzle_id, material = extruder_material_id)[0]
|
||||
extruder_stack.quality = ContainerRegistry.getInstance().findContainers(type = "quality", quality_type = quality_type)
|
||||
## Apply intent on the stacks.
|
||||
def selectIntent(self, intent_category, quality_type) -> None:
|
||||
application = CuraApplication.getInstance()
|
||||
global_stack = application.getGlobalContainerStack()
|
||||
current_definition_id = global_stack.definition.getMetaDataEntry("id")
|
||||
for extruder_stack in ExtruderManager.getInstance().getUsedExtruderStacks():
|
||||
nozzle_name = extruder_stack.variant.getMetaDataEntry("name")
|
||||
material_id = extruder_stack.material.getMetaDataEntry("base_file")
|
||||
intent = ContainerRegistry.getInstance().findContainers(definition = current_definition_id, variant = nozzle_name, material = material_id, quality_type = quality_type, intent_category = intent_category)
|
||||
if intent:
|
||||
extruder_stack.intent = intent[0]
|
||||
else:
|
||||
extruder_stack.intent = self.defaultIntent()
|
||||
|
||||
application.getMachineManager().setQualityGroupByQualityType(quality_type)
|
||||
|
||||
def selectDefaultIntent(self) -> None:
|
||||
category, quality_type = self.defaultIntent()
|
||||
|
Loading…
x
Reference in New Issue
Block a user