Add new nominal_layer_height setting, and make UI use it.
Some checks failed
conan-package / conan-package (push) Failing after 0s
unit-test / Run unit tests (push) Failing after 0s
printer-linter-format / Printer linter auto format (push) Failing after 1s
conan-package-resources / conan-package (push) Failing after 1s

This commit is contained in:
Frederic98 2024-12-17 13:36:13 +01:00
parent 382b98e8b0
commit 2999b9dcf6
11 changed files with 50 additions and 32 deletions

View File

@ -15,7 +15,7 @@ def fetchLayerHeight(quality_group: "QualityGroup") -> float:
from cura.CuraApplication import CuraApplication
global_stack = CuraApplication.getInstance().getMachineManager().activeMachine
default_layer_height = global_stack.definition.getProperty("layer_height", "value")
default_layer_height = global_stack.definition.getProperty("nominal_layer_height", "value")
# Get layer_height from the quality profile for the GlobalStack
if quality_group.node_for_global is None:
@ -23,13 +23,13 @@ def fetchLayerHeight(quality_group: "QualityGroup") -> float:
container = quality_group.node_for_global.container
layer_height = default_layer_height
if container and container.hasProperty("layer_height", "value"):
layer_height = container.getProperty("layer_height", "value")
if container and container.hasProperty("nominal_layer_height", "value"):
layer_height = container.getProperty("nominal_layer_height", "value")
else:
# Look for layer_height in the GlobalStack from material -> definition
container = global_stack.definition
if container and container.hasProperty("layer_height", "value"):
layer_height = container.getProperty("layer_height", "value")
if container and container.hasProperty("nominal_layer_height", "value"):
layer_height = container.getProperty("nominal_layer_height", "value")
if isinstance(layer_height, SettingFunction):
layer_height = layer_height(global_stack)

View File

@ -71,7 +71,7 @@ class QualityProfilesDropDownMenuModel(ListModel):
return
if not self._layer_height_unit:
unit = global_stack.definition.getProperty("layer_height", "unit")
unit = global_stack.definition.getProperty("nominal_layer_height", "unit")
if not unit:
unit = ""
self._layer_height_unit = unit

View File

@ -617,7 +617,7 @@ class MachineManager(QObject):
if not self._global_container_stack:
return 0
value = self._global_container_stack.getRawProperty("layer_height", "value", skip_until_container = self._global_container_stack.qualityChanges.getId())
value = self._global_container_stack.getRawProperty("nominal_layer_height", "value", skip_until_container = self._global_container_stack.qualityChanges.getId())
if isinstance(value, SettingFunction):
value = value(self._global_container_stack)
return value

View File

@ -798,10 +798,10 @@
"description": "All settings that influence the resolution of the print. These settings have a large impact on the quality (and print time)",
"children":
{
"layer_height":
"nominal_layer_height":
{
"label": "Layer Height",
"description": "The height of each layer in mm. Higher values produce faster prints in lower resolution, lower values produce slower prints in higher resolution.",
"label": "Nominal Layer Height",
"description": "The nominal layer height of the final printed part.",
"unit": "mm",
"type": "float",
"default_value": 0.1,
@ -809,21 +809,38 @@
"minimum_value_warning": "0.04",
"maximum_value_warning": "0.8 * min(extruderValues('machine_nozzle_size'))",
"settable_per_mesh": false,
"settable_per_extruder": false
},
"layer_height_0":
{
"label": "Initial Layer Height",
"description": "The height of the initial layer in mm. A thicker initial layer makes adhesion to the build plate easier.",
"unit": "mm",
"type": "float",
"default_value": 0.3,
"resolve": "min(extruderValues('layer_height_0'))",
"minimum_value": "0.001",
"minimum_value_warning": "0.1",
"maximum_value_warning": "0.8 * min(extruderValues('machine_nozzle_size'))",
"settable_per_mesh": false,
"settable_per_extruder": false
"settable_per_extruder": false,
"children":
{
"layer_height":
{
"label": "Layer Height",
"description": "The height of each layer in mm. Higher values produce faster prints in lower resolution, lower values produce slower prints in higher resolution.",
"unit": "mm",
"type": "float",
"default_value": 0.1,
"value": "nominal_layer_height",
"minimum_value": "0.001",
"minimum_value_warning": "0.04",
"maximum_value_warning": "0.8 * min(extruderValues('machine_nozzle_size'))",
"settable_per_mesh": false,
"settable_per_extruder": false
},
"layer_height_0":
{
"label": "Initial Layer Height",
"description": "The height of the initial layer in mm. A thicker initial layer makes adhesion to the build plate easier.",
"unit": "mm",
"type": "float",
"default_value": 0.3,
"resolve": "min(extruderValues('layer_height_0'))",
"minimum_value": "0.001",
"minimum_value_warning": "0.1",
"maximum_value_warning": "0.8 * min(extruderValues('machine_nozzle_size'))",
"settable_per_mesh": false,
"settable_per_extruder": false
}
}
},
"line_width":
{

View File

@ -105,7 +105,8 @@
"value": "5"
},
"jerk_travel_enabled": { "value": "True" },
"layer_height": { "value": "min(min(extruderValues('machine_nozzle_size')) / 2, 0.2)" },
"nominal_layer_height": { "value": "min(min(extruderValues('machine_nozzle_size')) / 2, 0.2)" },
"layer_height": { "value": "round(nominal_layer_height * material_shrinkage_percentage_z / 100, 5)" },
"machine_acceleration": { "default_value": 3000 },
"machine_depth": { "default_value": 240 },
"machine_end_gcode": { "default_value": "" },

View File

@ -26,7 +26,7 @@ RowLayout
{
id: layerHeight
containerStack: Cura.MachineManager.activeStack
key: "layer_height"
key: "nominal_layer_height"
watchedProperties: ["value"]
}
}

View File

@ -11,5 +11,5 @@ type = quality
weight = -2
[values]
layer_height = =round(0.2 * material_shrinkage_percentage_z / 100, 5)
nominal_layer_height = 0.2

View File

@ -11,5 +11,5 @@ type = quality
weight = -1
[values]
layer_height = =round(0.15 * material_shrinkage_percentage_z / 100, 5)
nominal_layer_height = 0.15

View File

@ -11,5 +11,5 @@ type = quality
weight = 0
[values]
layer_height = =round(0.1 * material_shrinkage_percentage_z / 100, 5)
nominal_layer_height = 0.1

View File

@ -11,5 +11,5 @@ type = quality
weight = -4
[values]
layer_height = =round(0.4 * material_shrinkage_percentage_z / 100, 5)
nominal_layer_height = 0.4

View File

@ -11,5 +11,5 @@ type = quality
weight = -3
[values]
layer_height = =round(0.3 * material_shrinkage_percentage_z / 100, 5)
nominal_layer_height = 0.3