Removed the settings: "material_shrinkage_percentage" and update code that was using this parameter.

material_shrinkage_percentage_xy and material_shrinkage_percentage_z cannot depend on material_shrinkage_percentage otherwise their resolve function will not execute properly.
I noticed that the shrinkage factors do not get the correct value if a wrong nozzle is chosen for a material. However, in that case the slicer will also not slice, so in practice this is not an issue

Relates to PP-77
This commit is contained in:
p.kuiper 2022-04-01 13:00:41 +02:00
parent 4bb79654d4
commit 733447a2dd
4 changed files with 24 additions and 44 deletions

View file

@ -383,7 +383,7 @@ class ConvexHullDecorator(SceneNodeDecorator):
# Shrinkage compensation. # Shrinkage compensation.
if not self._global_stack: # Should never happen. if not self._global_stack: # Should never happen.
return convex_hull return convex_hull
scale_factor = self._global_stack.getProperty("material_shrinkage_percentage", "value") / 100.0 scale_factor = self._global_stack.getProperty("material_shrinkage_percentage_xy", "value") / 100.0
result = convex_hull result = convex_hull
if scale_factor != 1.0 and not self.getNode().callDecoration("isGroup"): if scale_factor != 1.0 and not self.getNode().callDecoration("isGroup"):
center = None center = None

View file

@ -139,4 +139,4 @@ class ModelChecker(QObject, Extension):
global_container_stack = Application.getInstance().getGlobalContainerStack() global_container_stack = Application.getInstance().getGlobalContainerStack()
if global_container_stack is None: if global_container_stack is None:
return 100 return 100
return global_container_stack.getProperty("material_shrinkage_percentage", "value") return max(global_container_stack.getProperty("material_shrinkage_percentage_xy", "value"), global_container_stack.getProperty("material_shrinkage_percentage_z", "value"))

View file

@ -2527,10 +2527,10 @@
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": true "settable_per_extruder": true
}, },
"material_shrinkage_percentage": "material_shrinkage_percentage_xy":
{ {
"label": "Scaling Factor Shrinkage Compensation", "label": "Horizontal Scaling Factor Shrinkage Compensation",
"description": "To compensate for the shrinkage of the material as it cools down, the model will be scaled with this factor.", "description": "To compensate for the shrinkage of the material as it cools down, the model will be scaled with this factor in the XY-direction (horizontally).",
"unit": "%", "unit": "%",
"type": "float", "type": "float",
"default_value": null, "default_value": null,
@ -2540,42 +2540,22 @@
"maximum_value_warning": "120", "maximum_value_warning": "120",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false, "settable_per_extruder": false,
"resolve": "100 if sum(1 if s != None else 0 for s in extruderValues('material_shrinkage_percentage')) == 0 else sum(s if s != None else 0 for s in extruderValues('material_shrinkage_percentage'))/sum(1 if s != None else 0 for s in extruderValues('material_shrinkage_percentage'))", "resolve": "100 if sum(1 if s != None else 0 for s in extruderValues('material_shrinkage_percentage_xy')) == 0 else sum(s if s != None else 0 for s in extruderValues('material_shrinkage_percentage_xy'))/sum(1 if s != None else 0 for s in extruderValues('material_shrinkage_percentage_xy'))"
"children": },
{ "material_shrinkage_percentage_z":
"material_shrinkage_percentage_xy": {
{ "label": "Vertical Scaling Factor Shrinkage Compensation",
"label": "Horizontal Scaling Factor Shrinkage Compensation", "description": "To compensate for the shrinkage of the material as it cools down, the model will be scaled with this factor in the Z-direction (vertically).",
"description": "To compensate for the shrinkage of the material as it cools down, the model will be scaled with this factor in the XY-direction (horizontally).", "unit": "%",
"unit": "%", "type": "float",
"type": "float", "default_value": null,
"default_value": null, "enabled": true,
"enabled": true, "minimum_value": "0.001",
"minimum_value": "0.001", "minimum_value_warning": "100",
"minimum_value_warning": "100", "maximum_value_warning": "120",
"maximum_value_warning": "120", "settable_per_mesh": false,
"settable_per_mesh": false, "settable_per_extruder": false,
"settable_per_extruder": false, "resolve": "100 if sum(1 if s != None else 0 for s in extruderValues('material_shrinkage_percentage_z')) == 0 else sum(s if s != None else 0 for s in extruderValues('material_shrinkage_percentage_z'))/sum(1 if s != None else 0 for s in extruderValues('material_shrinkage_percentage_z'))"
"resolve": "100 if sum(1 if s != None else 0 for s in extruderValues('material_shrinkage_percentage_xy')) == 0 else sum(s if s != None else 0 for s in extruderValues('material_shrinkage_percentage_xy'))/sum(1 if s != None else 0 for s in extruderValues('material_shrinkage_percentage_xy'))",
"value": "material_shrinkage_percentage"
},
"material_shrinkage_percentage_z":
{
"label": "Vertical Scaling Factor Shrinkage Compensation",
"description": "To compensate for the shrinkage of the material as it cools down, the model will be scaled with this factor in the Z-direction (vertically).",
"unit": "%",
"type": "float",
"default_value": null,
"enabled": true,
"minimum_value": "0.001",
"minimum_value_warning": "100",
"maximum_value_warning": "120",
"settable_per_mesh": false,
"settable_per_extruder": false,
"resolve": "100 if sum(1 if s != None else 0 for s in extruderValues('material_shrinkage_percentage_z')) == 0 else sum(s if s != None else 0 for s in extruderValues('material_shrinkage_percentage_z'))/sum(1 if s != None else 0 for s in extruderValues('material_shrinkage_percentage_z'))",
"value": "material_shrinkage_percentage"
}
}
}, },
"material_crystallinity": "material_crystallinity":
{ {

View file

@ -117,6 +117,8 @@ material_bed_temperature
material_bed_temperature_layer_0 material_bed_temperature_layer_0
material_adhesion_tendency material_adhesion_tendency
material_surface_energy material_surface_energy
material_shrinkage_percentage_xy
material_shrinkage_percentage_z
material_flow material_flow
wall_material_flow wall_material_flow
wall_0_material_flow wall_0_material_flow
@ -133,9 +135,7 @@ prime_tower_flow
material_flow_layer_0 material_flow_layer_0
material_standby_temperature material_standby_temperature
material_alternate_walls material_alternate_walls
material_shrinkage_percentage
material_shrinkage_percentage_xy
material_shrinkage_percentage_z
[speed] [speed]
speed_print speed_print