Calculate extrusion width %s as a function of nozzle width, not layer height (#1578)

* Calculate extrusion width %s as a function of nozzle width, not layer height

* handled more width conversions

* more missing percent handling

* even more missed percent handling

* even more more extrusion % handling

* some fixes

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Jason M-H 2023-07-27 11:37:47 -04:00 committed by GitHub
parent 71ddef9724
commit be54f6bc99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 187 additions and 121 deletions

View file

@ -301,7 +301,7 @@ std::pair<double, double> adaptive_fill_line_spacing(const PrintObject &print_ob
bool nonempty = config.sparse_infill_density > 0;
bool has_adaptive_infill = nonempty && config.sparse_infill_pattern == ipAdaptiveCubic;
bool has_support_infill = nonempty && config.sparse_infill_pattern == ipSupportCubic;
double sparse_infill_line_width = config.sparse_infill_line_width;
double sparse_infill_line_width = config.sparse_infill_line_width.get_abs_value(max_nozzle_diameter);
region_fill_data.push_back(RegionFillData({
has_adaptive_infill ? Tristate::Maybe : Tristate::No,
has_support_infill ? Tristate::Maybe : Tristate::No,

View file

@ -75,9 +75,7 @@ Generator::Generator(const PrintObject &print_object, const std::function<void()
// Note: There's not going to be a layer below the first one, so the 'initial layer height' doesn't have to be taken into account.
const double layer_thickness = scaled<double>(object_config.layer_height.value);
//m_infill_extrusion_width = scaled<float>(region_config.infill_extrusion_width.percent ? default_infill_extrusion_width * 0.01 * region_config.infill_extrusion_width : region_config.infill_extrusion_width);
//m_supporting_radius = coord_t(m_infill_extrusion_width) * 100 / coord_t(region_config.fill_density.value);
m_infill_extrusion_width = scaled<float>(region_config.sparse_infill_line_width.value);
m_infill_extrusion_width = scaled<float>(region_config.sparse_infill_line_width.get_abs_value(max_nozzle_diameter));
m_supporting_radius = coord_t(m_infill_extrusion_width) * 100 / region_config.sparse_infill_density;
const double lightning_infill_overhang_angle = M_PI / 4; // 45 degrees
@ -103,7 +101,7 @@ Generator::Generator(PrintObject* m_object, std::vector<Polygons>& contours, std
// Note: There's not going to be a layer below the first one, so the 'initial layer height' doesn't have to be taken into account.
const double layer_thickness = scaled<double>(object_config.layer_height.value);
m_infill_extrusion_width = scaled<float>(region_config.sparse_infill_line_width.value);
m_infill_extrusion_width = scaled<float>(region_config.sparse_infill_line_width.get_abs_value(max_nozzle_diameter));
//m_supporting_radius: against to the density of lightning, failures may happen if set to high density
//higher density lightning makes support harder, more time-consuming on computing and printing, but more reliable on supporting overhangs
//lower density lightning performs opposite