Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsupermerill <merill@free.fr>2022-02-09 16:18:16 +0300
committersupermerill <merill@free.fr>2022-02-12 21:38:27 +0300
commitc50f76ec147145f6cb102550aec149a6ff64be81 (patch)
treeb6723081a8e96d90ebadb157b7c85cfc168e393f /src/libslic3r/PrintConfig.cpp
parent8be4368cad780ca5f37c68d46980d9c3c0f91015 (diff)
Fix spacing display error when using default extrusion width
supermerill/superslicer#2337
Diffstat (limited to 'src/libslic3r/PrintConfig.cpp')
-rw-r--r--src/libslic3r/PrintConfig.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp
index b9e7e63f6..eaab54d06 100644
--- a/src/libslic3r/PrintConfig.cpp
+++ b/src/libslic3r/PrintConfig.cpp
@@ -6665,6 +6665,7 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (opt_key.find("extrusion_width") != std::string::npos) {
const ConfigOptionFloats* nozzle_diameter_option = find_option<ConfigOptionFloats>("nozzle_diameter", this, config_collection);
const ConfigOptionFloat* layer_height_option = find_option<ConfigOptionFloat>("layer_height", this, config_collection);
+ ConfigOptionFloatOrPercent* default_width_option = this->option<ConfigOptionFloatOrPercent>("extrusion_width");
ConfigOptionFloatOrPercent* width_option = this->option<ConfigOptionFloatOrPercent>(opt_key);
float overlap_ratio = 1;
const ConfigOptionPercents* filament_max_overlap_option = find_option<ConfigOptionPercents>("filament_max_overlap", this, config_collection);
@@ -6681,7 +6682,7 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option) {
width_option->set_phony(false);
spacing_option->set_phony(true);
- Flow flow = Flow::new_from_config_width(FlowRole::frPerimeter, *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
+ Flow flow = Flow::new_from_config_width(FlowRole::frPerimeter, width_option->value == 0 ? *width_option : *default_width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
if (flow.width < flow.height) flow.height = flow.width;
spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
spacing_option->percent = width_option->percent;
@@ -6693,7 +6694,7 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option) {
width_option->set_phony(false);
spacing_option->set_phony(true);
- Flow flow = Flow::new_from_config_width(FlowRole::frPerimeter, *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
+ Flow flow = Flow::new_from_config_width(FlowRole::frPerimeter, width_option->value == 0 ? *width_option : *default_width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
if (flow.width < flow.height) flow.height = flow.width;
spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
spacing_option->percent = width_option->percent;
@@ -6706,7 +6707,7 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option && perimeter_overlap_option) {
width_option->set_phony(false);
spacing_option->set_phony(true);
- Flow flow = Flow::new_from_config_width(FlowRole::frExternalPerimeter, *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
+ Flow flow = Flow::new_from_config_width(FlowRole::frExternalPerimeter, width_option->value == 0 ? *width_option : *default_width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
if (flow.width < flow.height) flow.height = flow.width;
flow.spacing_ratio = std::min(flow.spacing_ratio, (float)perimeter_overlap_option->get_abs_value(1));
spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
@@ -6721,7 +6722,7 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option && external_perimeter_overlap_option) {
width_option->set_phony(false);
spacing_option->set_phony(true);
- Flow ext_perimeter_flow = Flow::new_from_config_width(FlowRole::frPerimeter, *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
+ Flow ext_perimeter_flow = Flow::new_from_config_width(FlowRole::frPerimeter, width_option->value == 0 ? *width_option : *default_width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
if (ext_perimeter_flow.width < ext_perimeter_flow.height) ext_perimeter_flow.height = ext_perimeter_flow.width;
ext_perimeter_flow.spacing_ratio = std::min(ext_perimeter_flow.spacing_ratio * 0.5f, float(external_perimeter_overlap_option->get_abs_value(0.25) + perimeter_overlap_option->get_abs_value(0.25)));
spacing_option->value = (width_option->percent) ? std::round(100 * ext_perimeter_flow.spacing() / max_nozzle_diameter) : (std::round(ext_perimeter_flow.spacing() * 10000) / 10000);
@@ -6734,7 +6735,7 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option) {
width_option->set_phony(false);
spacing_option->set_phony(true);
- Flow flow = Flow::new_from_config_width(FlowRole::frInfill, *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
+ Flow flow = Flow::new_from_config_width(FlowRole::frInfill, width_option->value == 0 ? *width_option : *default_width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
if (flow.width < flow.height) flow.height = flow.width;
spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
spacing_option->percent = width_option->percent;
@@ -6746,7 +6747,7 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option) {
width_option->set_phony(false);
spacing_option->set_phony(true);
- Flow flow = Flow::new_from_config_width(FlowRole::frSolidInfill, *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
+ Flow flow = Flow::new_from_config_width(FlowRole::frSolidInfill, width_option->value == 0 ? *width_option : *default_width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
if (flow.width < flow.height) flow.height = flow.width;
spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
spacing_option->percent = width_option->percent;
@@ -6758,7 +6759,7 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option) {
width_option->set_phony(false);
spacing_option->set_phony(true);
- Flow flow = Flow::new_from_config_width(FlowRole::frTopSolidInfill, *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
+ Flow flow = Flow::new_from_config_width(FlowRole::frTopSolidInfill, width_option->value == 0 ? *width_option : *default_width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
if (flow.width < flow.height) flow.height = flow.width;
spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
spacing_option->percent = width_option->percent;
@@ -6766,7 +6767,7 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
}
}
//if (opt_key == "support_material_extrusion_width") {
- // Flow flow = Flow::new_from_config_width(FlowRole::frSupportMaterial, *width_option, max_nozzle_diameter, layer_height_option->value, 0);
+ // Flow flow = Flow::new_from_config_width(FlowRole::frSupportMaterial, width_option->value == 0 ? *width_option : *default_width_option, max_nozzle_diameter, layer_height_option->value, 0);
// if (width_option->percent)
// this->set_key_value("support_material_extrusion_spacing", new ConfigOptionFloatOrPercent(std::round(100 * flow.spacing() / max_nozzle_diameter), true));
// else
@@ -6774,7 +6775,7 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
// something_changed = true;
//}
//if (opt_key == "skirt_extrusion_width") {
- // Flow flow = Flow::new_from_config_width(FlowRole::frPerimeter, *width_option, max_nozzle_diameter, layer_height_option->value, 0);
+ // Flow flow = Flow::new_from_config_width(FlowRole::frPerimeter, width_option->value == 0 ? *width_option : *default_width_option, max_nozzle_diameter, layer_height_option->value, 0);
// if (width_option->percent)
// this->set_key_value("skirt_extrusion_spacing", new ConfigOptionFloatOrPercent(std::round(100 * flow.spacing() / max_nozzle_diameter), true));
// else
@@ -6796,7 +6797,7 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
width_option->percent = true;
width_option->set_phony(false);
spacing_option->set_phony(true);
- Flow flow = Flow::new_from_config_width(FlowRole::frPerimeter, *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
+ Flow flow = Flow::new_from_config_width(FlowRole::frPerimeter, width_option->value == 0 ? *width_option : *default_width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
spacing_option->percent = width_option->percent;
something_changed = true;