NEW: add concentric infill pattern for ironing

Signed-off-by: qing.zhang <qing.zhang@bambulab.com>
Change-Id: Icd9f9fe0e39d86725faa98dd3eae82a4189130e0
This commit is contained in:
qing.zhang 2023-04-21 11:32:47 +08:00 committed by Lane.Wei
parent b5c7532700
commit 7b12dcb6ea
6 changed files with 41 additions and 16 deletions

View file

@ -513,6 +513,7 @@ void Layer::make_ironing()
// First classify regions based on the extruder used. // First classify regions based on the extruder used.
struct IroningParams { struct IroningParams {
InfillPattern pattern;
int extruder = -1; int extruder = -1;
bool just_infill = false; bool just_infill = false;
// Spacing of the ironing lines, also to calculate the extrusion flow from. // Spacing of the ironing lines, also to calculate the extrusion flow from.
@ -552,8 +553,7 @@ void Layer::make_ironing()
bool operator==(const IroningParams &rhs) const { bool operator==(const IroningParams &rhs) const {
return this->extruder == rhs.extruder && this->just_infill == rhs.just_infill && return this->extruder == rhs.extruder && this->just_infill == rhs.just_infill &&
this->line_spacing == rhs.line_spacing && this->height == rhs.height && this->speed == rhs.speed && this->line_spacing == rhs.line_spacing && this->height == rhs.height && this->speed == rhs.speed && this->angle == rhs.angle && this->pattern == rhs.pattern;
this->angle == rhs.angle;
} }
LayerRegion *layerm = nullptr; LayerRegion *layerm = nullptr;
@ -600,24 +600,36 @@ void Layer::make_ironing()
ironing_params.height = default_layer_height * 0.01 * config.ironing_flow; ironing_params.height = default_layer_height * 0.01 * config.ironing_flow;
ironing_params.speed = config.ironing_speed; ironing_params.speed = config.ironing_speed;
ironing_params.angle = config.infill_direction * M_PI / 180.; ironing_params.angle = config.infill_direction * M_PI / 180.;
ironing_params.pattern = config.ironing_pattern;
ironing_params.layerm = layerm; ironing_params.layerm = layerm;
by_extruder.emplace_back(ironing_params); by_extruder.emplace_back(ironing_params);
} }
} }
std::sort(by_extruder.begin(), by_extruder.end()); std::sort(by_extruder.begin(), by_extruder.end());
FillRectilinear fill;
FillParams fill_params; FillParams fill_params;
fill.set_bounding_box(this->object()->bounding_box());
fill.layer_id = this->id();
fill.z = this->print_z;
fill.overlap = 0;
fill_params.density = 1.; fill_params.density = 1.;
fill_params.monotonic = true; fill_params.monotonic = true;
InfillPattern f_pattern = ipRectilinear;
std::unique_ptr<Fill> f = std::unique_ptr<Fill>(Fill::new_from_type(f_pattern));
f->set_bounding_box(this->object()->bounding_box());
f->layer_id = this->id();
f->z = this->print_z;
f->overlap = 0;
for (size_t i = 0; i < by_extruder.size();) { for (size_t i = 0; i < by_extruder.size();) {
// Find span of regions equivalent to the ironing operation. // Find span of regions equivalent to the ironing operation.
IroningParams &ironing_params = by_extruder[i]; IroningParams &ironing_params = by_extruder[i];
// Create the filler object.
if( f_pattern != ironing_params.pattern )
{
f_pattern = ironing_params.pattern;
f = std::unique_ptr<Fill>(Fill::new_from_type(f_pattern));
f->set_bounding_box(this->object()->bounding_box());
f->layer_id = this->id();
f->z = this->print_z;
f->overlap = 0;
}
size_t j = i; size_t j = i;
for (++ j; j < by_extruder.size() && ironing_params == by_extruder[j]; ++ j) ; for (++ j; j < by_extruder.size() && ironing_params == by_extruder[j]; ++ j) ;
@ -679,10 +691,10 @@ void Layer::make_ironing()
} }
// Create the filler object. // Create the filler object.
fill.spacing = ironing_params.line_spacing; f->spacing = ironing_params.line_spacing;
fill.angle = float(ironing_params.angle + 0.25 * M_PI); f->angle = float(ironing_params.angle + 0.25 * M_PI);
fill.link_max_length = (coord_t)scale_(3. * fill.spacing); f->link_max_length = (coord_t) scale_(3. * f->spacing);
double extrusion_height = ironing_params.height * fill.spacing / nozzle_dmr; double extrusion_height = ironing_params.height * f->spacing / nozzle_dmr;
float extrusion_width = Flow::rounded_rectangle_extrusion_width_from_spacing(float(nozzle_dmr), float(extrusion_height)); float extrusion_width = Flow::rounded_rectangle_extrusion_width_from_spacing(float(nozzle_dmr), float(extrusion_height));
double flow_mm3_per_mm = nozzle_dmr * extrusion_height; double flow_mm3_per_mm = nozzle_dmr * extrusion_height;
Surface surface_fill(stTop, ExPolygon()); Surface surface_fill(stTop, ExPolygon());
@ -690,7 +702,7 @@ void Layer::make_ironing()
surface_fill.expolygon = std::move(expoly); surface_fill.expolygon = std::move(expoly);
Polylines polylines; Polylines polylines;
try { try {
polylines = fill.fill_surface(&surface_fill, fill_params); polylines = f->fill_surface(&surface_fill, fill_params);
} catch (InfillFailedException &) { } catch (InfillFailedException &) {
} }
if (! polylines.empty()) { if (! polylines.empty()) {

View file

@ -710,8 +710,8 @@ static std::vector<std::string> s_Preset_print_options {
"ensure_vertical_shell_thickness", "reduce_crossing_wall", "detect_thin_wall", "detect_overhang_wall", "ensure_vertical_shell_thickness", "reduce_crossing_wall", "detect_thin_wall", "detect_overhang_wall",
"seam_position", "wall_infill_order", "sparse_infill_density", "sparse_infill_pattern", "top_surface_pattern", "bottom_surface_pattern", "seam_position", "wall_infill_order", "sparse_infill_density", "sparse_infill_pattern", "top_surface_pattern", "bottom_surface_pattern",
"infill_direction", "bridge_angle", "infill_direction", "bridge_angle",
"minimum_sparse_infill_area", "reduce_infill_retraction", "minimum_sparse_infill_area", "reduce_infill_retraction", "ironing_pattern", "ironing_type",
"ironing_type", "ironing_flow", "ironing_speed", "ironing_spacing", "ironing_flow", "ironing_speed", "ironing_spacing",
"max_travel_detour_distance", "max_travel_detour_distance",
"fuzzy_skin", "fuzzy_skin_thickness", "fuzzy_skin_point_distance", "fuzzy_skin", "fuzzy_skin_thickness", "fuzzy_skin_point_distance",
#ifdef HAS_PRESSURE_EQUALIZER #ifdef HAS_PRESSURE_EQUALIZER

View file

@ -1649,6 +1649,17 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<IroningType>(IroningType::NoIroning)); def->set_default_value(new ConfigOptionEnum<IroningType>(IroningType::NoIroning));
def = this->add("ironing_pattern", coEnum);
def->label = L("Ironing Pattern");
def->category = L("Quality");
def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
def->enum_values.push_back("concentric");
def->enum_values.push_back("zig-zag");
def->enum_labels.push_back(L("Concentric"));
def->enum_labels.push_back(L("Rectilinear"));
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<InfillPattern>(ipRectilinear));
def = this->add("ironing_flow", coPercent); def = this->add("ironing_flow", coPercent);
def->label = L("Ironing flow"); def->label = L("Ironing flow");
def->category = L("Quality"); def->category = L("Quality");

View file

@ -729,6 +729,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionBool, infill_combination)) ((ConfigOptionBool, infill_combination))
// Ironing options // Ironing options
((ConfigOptionEnum<IroningType>, ironing_type)) ((ConfigOptionEnum<IroningType>, ironing_type))
((ConfigOptionEnum<InfillPattern>, ironing_pattern))
((ConfigOptionPercent, ironing_flow)) ((ConfigOptionPercent, ironing_flow))
((ConfigOptionFloat, ironing_spacing)) ((ConfigOptionFloat, ironing_spacing))
((ConfigOptionFloat, ironing_speed)) ((ConfigOptionFloat, ironing_speed))

View file

@ -631,7 +631,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
toggle_line(el, have_raft); toggle_line(el, have_raft);
bool has_ironing = (config->opt_enum<IroningType>("ironing_type") != IroningType::NoIroning); bool has_ironing = (config->opt_enum<IroningType>("ironing_type") != IroningType::NoIroning);
for (auto el : { "ironing_flow", "ironing_spacing", "ironing_speed" }) for (auto el : {"ironing_pattern", "ironing_flow", "ironing_spacing", "ironing_speed"})
toggle_line(el, has_ironing); toggle_line(el, has_ironing);
// bool have_sequential_printing = (config->opt_enum<PrintSequence>("print_sequence") == PrintSequence::ByObject); // bool have_sequential_printing = (config->opt_enum<PrintSequence>("print_sequence") == PrintSequence::ByObject);

View file

@ -1852,6 +1852,7 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Ironing"), L"param_ironing"); optgroup = page->new_optgroup(L("Ironing"), L"param_ironing");
optgroup->append_single_option_line("ironing_type"); optgroup->append_single_option_line("ironing_type");
optgroup->append_single_option_line("ironing_pattern");
optgroup->append_single_option_line("ironing_speed"); optgroup->append_single_option_line("ironing_speed");
optgroup->append_single_option_line("ironing_flow"); optgroup->append_single_option_line("ironing_flow");
optgroup->append_single_option_line("ironing_spacing"); optgroup->append_single_option_line("ironing_spacing");