ENH: add print_outer_first for wipe tower

and modify the min_depth_per_height
jira: none

Change-Id: I4860df661b4dd1f66677112d14e60560bc4a73be
This commit is contained in:
zhimin.zeng 2024-11-20 19:09:48 +08:00 committed by lane.wei
parent bde01dc181
commit 00810d685d
9 changed files with 26 additions and 8 deletions

View File

@ -594,7 +594,7 @@ WipeTower::ToolChangeResult WipeTower::construct_tcr(WipeTowerWriter& writer,
// BBS
const std::map<float, float> WipeTower::min_depth_per_height = {
{100.f, 20.f}, {250.f, 40.f}
{100.f, 20.f}, {180.f, 40.f}, {250.f, 50.f}, {350.f, 60.f}
};
WipeTower::WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origin, const float prime_volume, size_t initial_tool, const float wipe_tower_height) :
@ -617,7 +617,8 @@ WipeTower::WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origi
m_wipe_volume(prime_volume),
m_enable_timelapse_print(config.timelapse_type.value == TimelapseType::tlSmooth),
m_nozzle_change_length(config.extruder_change_length.get_at(0)),
m_is_multi_extruder(config.nozzle_diameter.size() > 1)
m_is_multi_extruder(config.nozzle_diameter.size() > 1),
m_is_print_outer_first(config.prime_tower_outer_first.value)
{
// Read absolute value of first layer speed, if given as percentage,
// it is taken over following default. Speeds from config are not
@ -863,7 +864,7 @@ WipeTower::ToolChangeResult WipeTower::tool_change(size_t tool, bool extrude_per
Vec2f initial_position = get_next_pos(cleaning_box, wipe_length);
writer.set_initial_position(initial_position, m_wipe_tower_width, m_wipe_tower_depth, m_internal_rotation);
if (extrude_perimeter) {
if (extrude_perimeter && m_is_print_outer_first) {
box_coordinates wt_box(Vec2f(0.f, (m_current_shape == SHAPE_REVERSED) ? m_layer_info->toolchanges_depth() - m_layer_info->depth : 0.f), m_wipe_tower_width,
m_layer_info->depth + m_perimeter_width);
@ -908,6 +909,14 @@ WipeTower::ToolChangeResult WipeTower::tool_change(size_t tool, bool extrude_per
toolchange_Wipe(writer, cleaning_box, wipe_length); // Wipe the newly loaded filament until the end of the assigned wipe area.
if (extrude_perimeter && !m_is_print_outer_first) {
box_coordinates wt_box(Vec2f(0.f, (m_current_shape == SHAPE_REVERSED) ? m_layer_info->toolchanges_depth() - m_layer_info->depth : 0.f), m_wipe_tower_width,
m_layer_info->depth + m_perimeter_width);
// align the perimeter
wt_box = align_perimeter(wt_box);
writer.rectangle(wt_box);
}
writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Wipe_Tower_End) + "\n");
++ m_num_tool_changes;
} else
@ -1014,8 +1023,7 @@ WipeTower::NozzleChangeResult WipeTower::nozzle_change(int old_filament_id, int
writer.set_extrusion_flow(m_extrusion_flow); // Reset the extrusion flow.
m_depth_traversed += (nozzle_change_line_count - 1) *dy + m_perimeter_width;
m_depth_traversed += nozzle_change_line_count * dy;
if (is_tpu_filament(m_current_tool))
{

View File

@ -325,6 +325,7 @@ private:
std::vector<int> m_filament_map;
bool m_has_tpu_filament{false};
bool m_is_multi_extruder{false};
bool m_is_print_outer_first{false};
// G-code generator parameters.
// BBS: remove useless config

View File

@ -879,7 +879,7 @@ static std::vector<std::string> s_Preset_print_options {
"inner_wall_line_width", "outer_wall_line_width", "sparse_infill_line_width", "internal_solid_infill_line_width",
"top_surface_line_width", "support_line_width", "infill_wall_overlap", "bridge_flow",
"elefant_foot_compensation", "xy_contour_compensation", "xy_hole_compensation", "resolution", "enable_prime_tower",
"prime_tower_width", "prime_tower_brim_width", "prime_volume",
"prime_tower_width", "prime_tower_brim_width", "prime_tower_outer_first", "prime_volume",
"wipe_tower_no_sparse_layers", "compatible_printers", "compatible_printers_condition", "inherits",
"flush_into_infill", "flush_into_objects", "flush_into_support","process_notes",
// BBS

View File

@ -254,6 +254,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|| opt_key == "enable_prime_tower"
|| opt_key == "prime_tower_width"
|| opt_key == "prime_tower_brim_width"
|| opt_key == "prime_tower_outer_first"
|| opt_key == "first_layer_print_sequence"
|| opt_key == "other_layers_print_sequence"
|| opt_key == "other_layers_print_sequence_nums"

View File

@ -4206,6 +4206,12 @@ void PrintConfigDef::init_fff_params()
def->min = 0.;
def->set_default_value(new ConfigOptionFloat(3.));
def = this->add("prime_tower_outer_first", coBool);
def->label = L("Outer first");
def->tooltip = L("The prime tower print outer first");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("flush_into_infill", coBool);
def->category = L("Flush options");
def->label = L("Flush into objects' infill");

View File

@ -1176,6 +1176,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionFloat, wipe_tower_per_color_wipe))
((ConfigOptionFloat, wipe_tower_rotation_angle))
((ConfigOptionFloat, prime_tower_brim_width))
((ConfigOptionBool, prime_tower_outer_first))
//((ConfigOptionFloat, wipe_tower_bridging))
((ConfigOptionFloats, flush_volumes_matrix))
((ConfigOptionFloats, flush_volumes_vector))

View File

@ -665,7 +665,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, in
toggle_field("standby_temperature_delta", have_ooze_prevention);
bool have_prime_tower = config->opt_bool("enable_prime_tower");
for (auto el : { "prime_tower_width", "prime_volume", "prime_tower_brim_width"})
for (auto el : {"prime_tower_width", "prime_volume", "prime_tower_brim_width", "prime_tower_outer_first"})
toggle_line(el, have_prime_tower);
for (auto el : {"flush_into_infill", "flush_into_support", "flush_into_objects"})

View File

@ -3150,7 +3150,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
"extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod",
"nozzle_height", "skirt_loops", "skirt_distance",
"brim_width", "brim_object_gap", "brim_type", "nozzle_diameter", "single_extruder_multi_material",
"enable_prime_tower", "wipe_tower_x", "wipe_tower_y", "prime_tower_width", "prime_tower_brim_width", "prime_volume",
"enable_prime_tower", "wipe_tower_x", "wipe_tower_y", "prime_tower_width", "prime_tower_brim_width", "prime_tower_outer_first", "prime_volume",
"extruder_colour", "filament_colour", "material_colour", "printable_height", "extruder_printable_height", "printer_model", "printer_technology",
// These values are necessary to construct SlicingParameters by the Canvas3D variable layer height editor.
"layer_height", "initial_layer_print_height", "min_layer_height", "max_layer_height",

View File

@ -2191,6 +2191,7 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Prime tower"), L"param_tower");
optgroup->append_single_option_line("enable_prime_tower","parameter/prime-tower");
optgroup->append_single_option_line("prime_tower_outer_first", "parameter/prime-tower");
optgroup->append_single_option_line("prime_tower_width","parameter/prime-tower");
optgroup->append_single_option_line("prime_volume","parameter/prime-tower");
optgroup->append_single_option_line("prime_tower_brim_width","parameter/prime-tower");