diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 44c0f2a5a..1cdc9eef6 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -508,6 +508,9 @@ static std::vector get_path_of_change_filament(const Print& print) config.set_key_value("flush_length", new ConfigOptionFloat(purge_length)); int flush_count = std::min(g_max_flush_count, (int)std::round(purge_volume / g_purge_volume_one_time)); + // handle cases for very small purge + if (flush_count == 0 && purge_volume > 0) + flush_count += 1; float flush_unit = purge_length / flush_count; int flush_idx = 0; for (; flush_idx < flush_count; flush_idx++) { @@ -5570,6 +5573,9 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z, bool b dyn_config.set_key_value("flush_length", new ConfigOptionFloat(wipe_length)); int flush_count = std::min(g_max_flush_count, (int)std::round(wipe_volume / g_purge_volume_one_time)); + // handle cases for very small purge + if (flush_count == 0 && wipe_volume > 0) + flush_count += 1; float flush_unit = wipe_length / flush_count; int flush_idx = 0; for (; flush_idx < flush_count; flush_idx++) {