support has_single_extruder_multi_material_priming

This commit is contained in:
SoftFever 2024-07-08 00:35:22 +08:00
parent b6a1a06c25
commit 1c68d58343
3 changed files with 33 additions and 35 deletions

View file

@ -2180,16 +2180,13 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
// No object to print was found, cancel the G-code export.
throw Slic3r::SlicingError(_(L("No object can be printed. Maybe too small")));
has_wipe_tower = print.has_wipe_tower() && tool_ordering.has_wipe_tower();
// BBS: priming logic is removed, so 1st layer tool_ordering also respect the object tool sequence
#if 0
// Orca: support all extruder priming
initial_extruder_id = (has_wipe_tower && !print.config().single_extruder_multi_material_priming) ?
// The priming towers will be skipped.
tool_ordering.all_extruders().back() :
// Don't skip the priming towers.
tool_ordering.first_extruder();
#else
initial_extruder_id = tool_ordering.first_extruder();
#endif
//BBS: try to find the non-support filament extruder if is multi color and initial_extruder is support filament
if (initial_extruder_id != static_cast<unsigned int>(-1)) {
initial_non_support_extruder_id = initial_extruder_id;
@ -2270,7 +2267,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
this->placeholder_parser().set("current_object_idx", 0);
// For the start / end G-code to do the priming and final filament pull in case there is no wipe tower provided.
this->placeholder_parser().set("has_wipe_tower", has_wipe_tower);
//this->placeholder_parser().set("has_single_extruder_multi_material_priming", has_wipe_tower && print.config().single_extruder_multi_material_priming);
this->placeholder_parser().set("has_single_extruder_multi_material_priming", has_wipe_tower && print.config().single_extruder_multi_material_priming);
this->placeholder_parser().set("total_toolchanges", std::max(0, print.wipe_tower_data().number_of_toolchanges)); // Check for negative toolchanges (single extruder mode) and set to 0 (no tool change).
this->placeholder_parser().set("num_extruders", int(print.config().nozzle_diameter.values.size()));
this->placeholder_parser().set("retract_length", new ConfigOptionFloats(print.config().retraction_length));
@ -2511,8 +2508,8 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
}
}
// BBS: priming logic is removed, always set first extruer here.
//if (! (has_wipe_tower && print.config().single_extruder_multi_material_priming))
// Orca: support extruder priming
if (! (has_wipe_tower && print.config().single_extruder_multi_material_priming))
{
// Set initial extruder only after custom start G-code.
// Ugly hack: Do not set the initial extruder if the extruder is primed using the MMU priming towers at the edge of the print bed.
@ -2642,7 +2639,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
m_wipe_tower.reset(new WipeTowerIntegration(print.config(), print.get_plate_index(), print.get_plate_origin(), * print.wipe_tower_data().priming.get(), print.wipe_tower_data().tool_changes, *print.wipe_tower_data().final_purge.get()));
//BBS
file.write(m_writer.travel_to_z(initial_layer_print_height + m_config.z_offset.value, "Move to the first layer height"));
#if 0
if (print.config().single_extruder_multi_material_priming) {
file.write(m_wipe_tower->prime(*this));
// Verify, whether the print overaps the priming extrusions.
@ -2667,19 +2664,17 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
file.write("M1 S10\n");
}
}
//BBS: only support Marlin
//else {
else {
// This is not Marlin, M1 command is probably not supported.
//if (overlap) {
// print.active_step_add_warning(PrintStateBase::WarningLevel::CRITICAL,
// _(L("Your print is very close to the priming regions. "
// "Make sure there is no collision.")));
//} else {
// // Just continue printing, no action necessary.
//}
//}
if (overlap) {
print.active_step_add_warning(PrintStateBase::WarningLevel::CRITICAL,
_(L("Your print is very close to the priming regions. "
"Make sure there is no collision.")));
} else {
// Just continue printing, no action necessary.
}
}
}
#endif
print.throw_if_canceled();
}
// Process all layers of all objects (non-sequential mode) with a parallel pipeline: