0 extrusion_spacing will always create 0-auto-extrusion_width.

clean cout
supermerill/SuperSlicer#2084
This commit is contained in:
supermerill 2021-12-20 03:51:45 +01:00
parent 3d1c29c0e0
commit 2f4b55ed3c
2 changed files with 34 additions and 13 deletions

View File

@ -168,8 +168,6 @@ void FillGyroid::_fill_surface_single(
const double tolerance_old = std::min(this->get_spacing() / 2, FillGyroid::PatternTolerance) / unscaled(scaleFactor); const double tolerance_old = std::min(this->get_spacing() / 2, FillGyroid::PatternTolerance) / unscaled(scaleFactor);
const double tolerance_old2 = std::min(this->get_spacing() / 2, FillGyroid::PatternTolerance) * density_adjusted / this->get_spacing(); const double tolerance_old2 = std::min(this->get_spacing() / 2, FillGyroid::PatternTolerance) * density_adjusted / this->get_spacing();
const double tolerance = params.config->get_computed_value("resolution_internal") * density_adjusted / this->get_spacing(); const double tolerance = params.config->get_computed_value("resolution_internal") * density_adjusted / this->get_spacing();
std::cout << "gyroid tolerance: " << tolerance_old << " == " << tolerance_old2 << " ? "<< tolerance << "\n";
std::cout << "this->get_spacing(): " << this->get_spacing() << " , scaleFactor= " << unscaled(scaleFactor) << " , min(spa, 0.2)= " << std::min(this->get_spacing() / 2, FillGyroid::PatternTolerance) << "\n";
// generate pattern // generate pattern
Polylines polylines = make_gyroid_waves( Polylines polylines = make_gyroid_waves(

View File

@ -6531,7 +6531,10 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option) { if (width_option) {
width_option->set_phony(true); width_option->set_phony(true);
spacing_option->set_phony(false); spacing_option->set_phony(false);
width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); if (spacing_value == 0)
width_option->value = 0;
else
width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000);
width_option->percent = spacing_option->percent; width_option->percent = spacing_option->percent;
something_changed = true; something_changed = true;
} }
@ -6541,7 +6544,10 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option) { if (width_option) {
width_option->set_phony(true); width_option->set_phony(true);
spacing_option->set_phony(false); spacing_option->set_phony(false);
width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); if (spacing_value == 0)
width_option->value = 0;
else
width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000);
width_option->percent = spacing_option->percent; width_option->percent = spacing_option->percent;
something_changed = true; something_changed = true;
} }
@ -6552,9 +6558,13 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option && perimeter_overlap_option) { if (width_option && perimeter_overlap_option) {
width_option->set_phony(true); width_option->set_phony(true);
spacing_option->set_phony(false); spacing_option->set_phony(false);
flow.spacing_ratio = std::min(flow.spacing_ratio, float(perimeter_overlap_option->get_abs_value(1))); if(spacing_value == 0)
flow.width = spacing_option->get_abs_value(max_nozzle_diameter) + layer_height_option->value * (1. - 0.25 * PI) * flow.spacing_ratio; width_option->value = 0;
width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); else {
flow.spacing_ratio = std::min(flow.spacing_ratio, float(perimeter_overlap_option->get_abs_value(1)));
flow.width = spacing_option->get_abs_value(max_nozzle_diameter) + layer_height_option->value * (1. - 0.25 * PI) * flow.spacing_ratio;
width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000);
}
width_option->percent = spacing_option->percent; width_option->percent = spacing_option->percent;
something_changed = true; something_changed = true;
} }
@ -6566,9 +6576,13 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option && external_perimeter_overlap_option) { if (width_option && external_perimeter_overlap_option) {
width_option->set_phony(true); width_option->set_phony(true);
spacing_option->set_phony(false); spacing_option->set_phony(false);
flow.spacing_ratio = std::min(flow.spacing_ratio * 0.5f, float(external_perimeter_overlap_option->get_abs_value(0.25) + perimeter_overlap_option->get_abs_value(0.25))); if (spacing_value == 0)
flow.width = spacing_option->get_abs_value(max_nozzle_diameter) + layer_height_option->value * (1. - 0.25 * PI) * flow.spacing_ratio; width_option->value = 0;
width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); else {
flow.spacing_ratio = std::min(flow.spacing_ratio * 0.5f, float(external_perimeter_overlap_option->get_abs_value(0.25) + perimeter_overlap_option->get_abs_value(0.25)));
flow.width = spacing_option->get_abs_value(max_nozzle_diameter) + layer_height_option->value * (1. - 0.25 * PI) * flow.spacing_ratio;
width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000);
}
width_option->percent = spacing_option->percent; width_option->percent = spacing_option->percent;
something_changed = true; something_changed = true;
} }
@ -6578,7 +6592,10 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option) { if (width_option) {
width_option->set_phony(true); width_option->set_phony(true);
spacing_option->set_phony(false); spacing_option->set_phony(false);
width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); if (spacing_value == 0)
width_option->value = 0;
else
width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000);
width_option->percent = spacing_option->percent; width_option->percent = spacing_option->percent;
something_changed = true; something_changed = true;
} }
@ -6588,7 +6605,10 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option) { if (width_option) {
width_option->set_phony(true); width_option->set_phony(true);
spacing_option->set_phony(false); spacing_option->set_phony(false);
width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); if (spacing_value == 0)
width_option->value = 0;
else
width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000);
width_option->percent = spacing_option->percent; width_option->percent = spacing_option->percent;
something_changed = true; something_changed = true;
} }
@ -6598,7 +6618,10 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option) { if (width_option) {
width_option->set_phony(true); width_option->set_phony(true);
spacing_option->set_phony(false); spacing_option->set_phony(false);
width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000); if (spacing_value == 0)
width_option->value = 0;
else
width_option->value = (spacing_option->percent) ? std::round(100 * flow.width / max_nozzle_diameter) : (std::round(flow.width * 10000) / 10000);
width_option->percent = spacing_option->percent; width_option->percent = spacing_option->percent;
something_changed = true; something_changed = true;
} }