ENH:remove restrictions on mixed use of high and low temp filaments

jira: STUDIO-10482
Change-Id: Ifdf6f11b45f2e6d138ea615a3ad1f23d40ad3fe9
(cherry picked from commit 0178e930809cabcdbc09ab305e70e4323598b343)
This commit is contained in:
zhimin.zeng 2025-02-18 15:15:24 +08:00 committed by lane.wei
parent d179978ae8
commit 8f92391717
7 changed files with 64 additions and 4 deletions

View File

@ -271,6 +271,10 @@ void AppConfig::set_defaults()
set_bool("auto_calculate", true);
}
if (get("enable_high_low_temp_mixed_printing").empty()){
set_bool("enable_high_low_temp_mixed_printing", false);
}
if (get("auto_calculate_when_filament_change").empty()){
set_bool("auto_calculate_when_filament_change", true);
}

View File

@ -1022,6 +1022,9 @@ int Print::get_compatible_filament_type(const std::set<int>& filament_types)
//BBS: this function is used to check whether multi filament can be printed
StringObjectException Print::check_multi_filament_valid(const Print& print)
{
if (!print.need_check_multi_filaments_compatibility())
return {std::string()};
auto print_config = print.config();
std::vector<unsigned int> extruders = print.extruders();
std::vector<std::string> filament_types;

View File

@ -965,6 +965,9 @@ public:
BoundingBoxf get_wipe_tower_bbx() const { return m_wipe_tower_data.bbx; }
Vec2f get_rib_offset() const { return m_wipe_tower_data.rib_offset; }
void set_check_multi_filaments_compatibility(bool check) { m_need_check_multi_filaments_compatibility = check; }
bool need_check_multi_filaments_compatibility() const { return m_need_check_multi_filaments_compatibility; }
// scaled point
Vec2d translate_to_print_space(const Point& point) const;
static FilamentTempType get_filament_temp_type(const std::string& filament_type);
@ -1047,6 +1050,8 @@ private:
// OrcaSlicer: calibration
Calib_Params m_calib_params;
bool m_need_check_multi_filaments_compatibility{true};
// To allow GCode to set the Print's GCodeExport step status.
friend class GCode;
// Allow PrintObject to access m_mutex and m_cancel_callback.

View File

@ -241,7 +241,13 @@ void MsgDialog::finalize()
// Text shown as HTML, so that mouse selection and Ctrl-V to copy will work.
static void add_msg_content(wxWindow* parent, wxBoxSizer* content_sizer, wxString msg, bool monospaced_font = false, bool is_marked_msg = false)
static void add_msg_content(wxWindow *parent,
wxBoxSizer *content_sizer,
wxString msg,
bool monospaced_font = false,
bool is_marked_msg = false,
const wxString &link_text = "",
std::function<void(const wxString &)> link_callback = nullptr)
{
wxHtmlWindow* html = new wxHtmlWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO);
html->SetBackgroundColour(StateColor::darkModeColorFor(*wxWHITE));
@ -325,9 +331,19 @@ static void add_msg_content(wxWindow* parent, wxBoxSizer* content_sizer, wxStrin
if (monospaced_font)
// Code formatting will be preserved. This is useful for reporting errors from the placeholder parser.
msg_escaped = std::string("<pre><code>") + msg_escaped + "</code></pre>";
if (!link_text.IsEmpty() && link_callback) {
msg_escaped += "<span><a href=\"#\" style=\"color:rgb(8, 153, 46); text-decoration:underline;\">" + std::string(link_text.ToUTF8().data()) + "</a></span>";
}
html->SetPage("<html><body bgcolor=\"" + bgr_clr_str + "\"><font color=\"" + text_clr_str + "\">" + wxString::FromUTF8(msg_escaped.data()) + "</font></body></html>");
content_sizer->Add(html, 1, wxEXPAND|wxRIGHT, 8);
wxGetApp().UpdateDarkUIWin(html);
html->Bind(wxEVT_HTML_LINK_CLICKED, [=](wxHtmlLinkEvent& event) {
if (link_callback)
link_callback(event.GetLinkInfo().GetHref());
});
}
// ErrorDialog
@ -367,10 +383,12 @@ MessageDialog::MessageDialog(wxWindow* parent,
const wxString& message,
const wxString& caption/* = wxEmptyString*/,
long style /* = wxOK*/,
const wxString &forward_str /* = wxEmptyString*/)
const wxString &forward_str /* = wxEmptyString*/,
const wxString &link_text /* = wxEmptyString*/,
std::function<void(const wxString &)> link_callback /* = nullptr*/)
: MsgDialog(parent, caption.IsEmpty() ? wxString::Format(_L("%s info"), SLIC3R_APP_FULL_NAME) : caption, wxEmptyString, style, wxBitmap(),forward_str)
{
add_msg_content(this, content_sizer, message);
add_msg_content(this, content_sizer, message, false, false, link_text, link_callback);
SetMaxSize(MSG_DLG_MAX_SIZE);
finalize();
}

View File

@ -152,7 +152,13 @@ class MessageDialog : public MsgDialog
{
public:
// NOTE! Don't change a signature of contsrucor. It have to be tha same as for wxMessageDialog
MessageDialog(wxWindow *parent,const wxString& message, const wxString &caption = wxEmptyString, long style = wxOK,const wxString& forward_str = "");
MessageDialog(wxWindow *parent,
const wxString &message,
const wxString &caption = wxEmptyString,
long style = wxOK,
const wxString &forward_str = "",
const wxString &link_text = "",
std::function<void(const wxString &)> link_callback = nullptr);
MessageDialog(MessageDialog&&) = delete;
MessageDialog(const MessageDialog&) = delete;
MessageDialog &operator=(MessageDialog&&) = delete;

View File

@ -6666,6 +6666,8 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
this->preview->update_gcode_result(partplate_list.get_current_slice_result());
}
background_process.fff_print()->set_check_multi_filaments_compatibility(wxGetApp().app_config->get("enable_high_low_temp_mixed_printing") == "false");
Print::ApplyStatus invalidated;
const auto& preset_bundle = wxGetApp().preset_bundle;
if (preset_bundle->get_printer_extruder_count() > 1) {
@ -15979,6 +15981,7 @@ void Plater::validate_current_plate(bool& model_fits, bool& validate_error)
StringObjectException warning;
Polygons polygons;
std::vector<std::pair<Polygon, float>> height_polygons;
p->background_process.fff_print()->set_check_multi_filaments_compatibility(wxGetApp().app_config->get("enable_high_low_temp_mixed_printing") == "false");
StringObjectException err = p->background_process.validate(&warning, &polygons, &height_polygons);
// update string by type
post_process_string_object_exception(err);

View File

@ -846,6 +846,25 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
}
}
if (param == "enable_high_low_temp_mixed_printing") {
if (checkbox->GetValue()) {
MessageDialog msg_wingow(nullptr, _L("Printing with multiple filaments that have a large temperature difference can cause the extruder and nozzle to be blocked or dameged during printing.\nPlease enable with caution."),
_L("Warning"), wxICON_WARNING | wxYES | wxYES_DEFAULT | wxCANCEL | wxCENTRE, wxEmptyString,
_L("Click Wiki for help."), [](const wxString){
std::string language = wxGetApp().app_config->get("language");
wxString region = L"en";
if (language.find("zh") == 0) region = L"zh";
const wxString wiki_link = wxString::Format(L"https://wiki.bambulab.com/%s/filament-acc/filament/h2d-filament-config-limit", region);
wxGetApp().open_browser_with_warning_dialog(wiki_link);
});
if (msg_wingow.ShowModal() != wxID_YES) {
checkbox->SetValue(false);
app_config->set_bool(param, false);
app_config->save();
}
}
}
#ifdef __WIN32__
if (param == "prefer_to_use_dgpu") {
app_config->set_bool(param, checkbox->GetValue());
@ -1153,6 +1172,7 @@ wxWindow* PreferencesDialog::create_general_page()
auto item_multi_machine = create_item_checkbox(_L("Multi-device Management(Take effect after restarting Studio)."), page, _L("With this option enabled, you can send a task to multiple devices at the same time and manage multiple devices."), 50, "enable_multi_machine");
auto item_step_mesh_setting = create_item_checkbox(_L("Show the step mesh parameter setting dialog."), page, _L("If enabled,a parameter settings dialog will appear during STEP file import."), 50, "enable_step_mesh_setting");
auto item_beta_version_update = create_item_checkbox(_L("Support beta version update."), page, _L("With this option enabled, you can receive beta version updates."), 50, "enable_beta_version_update");
auto item_mix_print_high_low_temperature = create_item_checkbox(_L("Remove the restriction on high and low temperature mixed printing."), page, _L("With this option enabled, you can print materials with different chamber temperatures together."), 50, "enable_high_low_temp_mixed_printing");
auto _3d_settings = create_item_title(_L("3D Settings"), page, _L("3D Settings"));
auto item_mouse_zoom_settings = create_item_checkbox(_L("Zoom to mouse position"), page,
_L("Zoom in towards the mouse pointer's position in the 3D view, rather than the 2D window center."), 50,
@ -1264,6 +1284,7 @@ wxWindow* PreferencesDialog::create_general_page()
sizer_page->Add(item_step_mesh_setting, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_beta_version_update, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_auto_transfer_when_switch_preset, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_mix_print_high_low_temperature, 0, wxTOP, FromDIP(3));
sizer_page->Add(_3d_settings, 0, wxTOP | wxEXPAND, FromDIP(20));
sizer_page->Add(item_mouse_zoom_settings, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_show_shells_in_preview_settings, 0, wxTOP, FromDIP(3));