ENH: add print_outer_first for wipe tower

and modify the min_depth_per_height
jira: none

Change-Id: I4860df661b4dd1f66677112d14e60560bc4a73be
(cherry picked from commit 00810d685d01a91b5373f3315413aaef1fe49cbc)
This commit is contained in:
zhimin.zeng
2024-11-20 19:09:48 +08:00
committed by Noisyfox
parent 96f081df27
commit 34ebd54680
9 changed files with 26 additions and 8 deletions

View File

@@ -601,7 +601,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) :
@@ -624,7 +624,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
@@ -870,7 +871,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);
@@ -904,6 +905,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
@@ -1010,8 +1019,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

@@ -329,6 +329,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.
float m_cooling_tube_retraction = 0.f;

View File

@@ -815,7 +815,7 @@ static std::vector<std::string> s_Preset_print_options {
"skin_infill_line_width","skeleton_infill_line_width",
"top_surface_line_width", "support_line_width", "infill_wall_overlap","top_bottom_infill_wall_overlap", "bridge_flow", "internal_bridge_flow",
"elefant_foot_compensation", "elefant_foot_compensation_layers", "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",
"tree_support_branch_angle", "tree_support_angle_slow", "tree_support_wall_count", "tree_support_top_rate", "tree_support_branch_distance", "tree_support_tip_diameter",

View File

@@ -297,6 +297,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

@@ -5993,6 +5993,12 @@ void PrintConfigDef::init_fff_params()
"volumes below.");
def->set_default_value(new ConfigOptionFloats { 70., 70., 70., 70., 70., 70., 70., 70., 70., 70. });
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

@@ -1431,6 +1431,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))
((ConfigOptionPercent, wipe_tower_extra_flow))
((ConfigOptionFloats, flush_volumes_matrix))

View File

@@ -758,7 +758,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
toggle_line("preheat_steps", have_ooze_prevention && (preheat_steps > 0));
bool have_prime_tower = config->opt_bool("enable_prime_tower");
for (auto el : { "prime_tower_width", "prime_tower_brim_width"})
for (auto el : {"prime_tower_width", "prime_tower_brim_width", "prime_tower_outer_first"})
toggle_line(el, have_prime_tower);
for (auto el : {"wall_filament", "sparse_infill_filament", "solid_infill_filament", "wipe_tower_filament"})

View File

@@ -3112,7 +3112,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
"extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod",
"nozzle_height", "skirt_type", "skirt_loops", "skirt_speed","min_skirt_length", "skirt_distance", "skirt_start_angle",
"brim_width", "brim_object_gap", "brim_type", "nozzle_diameter", "single_extruder_multi_material", "preferred_orientation",
"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

@@ -2417,6 +2417,7 @@ void TabPrint::build()
page = add_options_page(L("Multimaterial"), "custom-gcode_multi_material"); // ORCA: icon only visible on placeholders
optgroup = page->new_optgroup(L("Prime tower"), L"param_tower");
optgroup->append_single_option_line("enable_prime_tower", "multimaterial_settings_prime_tower");
optgroup->append_single_option_line("prime_tower_outer_first", "parameter/prime-tower");
optgroup->append_single_option_line("prime_tower_width", "multimaterial_settings_prime_tower#width");
optgroup->append_single_option_line("prime_volume", "multimaterial_settings_prime_tower");
optgroup->append_single_option_line("prime_tower_brim_width", "multimaterial_settings_prime_tower#brim-width");