mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-01-30 23:48:44 +03:00
Update calib_dlg
This commit is contained in:
@@ -5466,12 +5466,14 @@ void Plater::calib_flowrate_f(int pass, const Calib_Params ¶ms)
|
||||
Tab *tab_filament = wxGetApp().get_tab(Preset::TYPE_FILAMENT);
|
||||
Tab *tab_printer = wxGetApp().get_tab(Preset::TYPE_PRINTER);
|
||||
DynamicPrintConfig new_config;
|
||||
auto printerConfig = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
int extru_multip = params.start * 100;
|
||||
auto start_gcode = printerConfig->opt_string("start_gcode");
|
||||
new_config.set_key_value("complete_objects", new ConfigOptionBool(true));
|
||||
new_config.set_key_value("extruder_clearance_radius", new ConfigOptionFloat(1));
|
||||
new_config.set_key_value("extrusion_multiplier", new ConfigOptionFloats{1.});
|
||||
new_config.set_key_value("start_gcode",
|
||||
new ConfigOptionString("G28\nM141 S0\nG0 Z50 F600\nM190 S[first_layer_bed_temperature]\nG28 Z\nG29 ; mesh bed leveling ,comment this code to close it\nG0 X0 Y0 Z50 F6000\nM109 S[first_layer_temperature]\nM83\nG0 X{max((min(print_bed_max[0], first_layer_print_min[0] + 80) - 85),0)} Y{max((min(print_bed_max[1], first_layer_print_min[1] + 80) - 85),0)} Z5 F6000\nG0 Z0.2 F600\nG1 E3 F1800\nG1 X{(min(print_bed_max[0], first_layer_print_min[0] + 80))} E{85 * 0.04} F3000\nG1 Y{max((min(print_bed_max[1], first_layer_print_min[1] + 80) - 85),0) + 2} E{2 * 0.04} F3000\nG1 X{max((min(print_bed_max[0], first_layer_print_min[0] + 80) - 85),0)} E{85 * 0.04} F3000\nG1 Y{max((min(print_bed_max[1], first_layer_print_min[1] + 80) - 85),0) + 85} E{83 * 0.04} F3000\nG1 X{max((min(print_bed_max[0], first_layer_print_min[0] + 80) - 85),0) + 2} E{2 * 0.04} F3000\nG1 Y{max((min(print_bed_max[1], first_layer_print_min[1] + 80) - 85),0) + 3} E{82 * 0.04} F3000\nG1 X{max((min(print_bed_max[0], first_layer_print_min[0] + 80) - 85),0) + 12} E{-10 * 0.04} F3000\nG1 E{10 * 0.04} F3000\nM221 S"+std::to_string(extru_multip)));
|
||||
new ConfigOptionString(start_gcode + "\nM221 S"+std::to_string(extru_multip)));
|
||||
new_config.set_key_value("between_objects_gcode",
|
||||
new ConfigOptionString("{if current_object_idx==1}M221 S"+std::to_string(extru_multip+1)+"{endif}"
|
||||
"{if current_object_idx==2}M221 S"+std::to_string(extru_multip+2)+"{endif}"
|
||||
|
||||
@@ -41,33 +41,57 @@ FRF_Calibration_Dlg::FRF_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater
|
||||
SetSizer(v_sizer);
|
||||
|
||||
// Settings
|
||||
DynamicPrintConfig m_config;
|
||||
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
|
||||
wxString start_length_str = _L("Extrusion Multipler: ");
|
||||
auto text_size = wxWindow::GetTextExtent(start_length_str);
|
||||
text_size.x = text_size.x * 1.5;
|
||||
wxStaticBoxSizer* settings_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _L("Settings"));
|
||||
|
||||
auto st_size = FromDIP(wxSize(text_size.x, -1));
|
||||
auto ti_size = FromDIP(wxSize(90, -1));
|
||||
// extru length
|
||||
auto desc_size = FromDIP(wxSize(300, -1));
|
||||
|
||||
// extru
|
||||
auto multip = filament_config->opt_float("extrusion_multiplier",0);
|
||||
std::string multip_str = std::to_string(multip);
|
||||
if (multip_str.find(".") > 0) {
|
||||
size_t fp = multip_str.rfind(".");
|
||||
size_t f = multip_str.rfind("0");
|
||||
while (f > fp) {
|
||||
if (f != -1) {
|
||||
multip_str = multip_str.erase(f);
|
||||
}
|
||||
f = multip_str.rfind("0");
|
||||
}
|
||||
fp = multip_str.rfind(".");
|
||||
if (fp == multip_str.size() - 1) {
|
||||
multip_str = multip_str.erase(fp);
|
||||
}
|
||||
}
|
||||
auto start_length_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
auto start_length_text = new wxStaticText(this, wxID_ANY, start_length_str, wxDefaultPosition, st_size, wxALIGN_LEFT);
|
||||
m_tiExtru = new TextInput(this, "", "", "", wxDefaultPosition, ti_size, wxTE_CENTRE);
|
||||
m_tiExtru = new TextInput(this, multip_str, "", "", wxDefaultPosition, ti_size, wxTE_CENTRE);
|
||||
m_tiExtru->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
|
||||
|
||||
// desc
|
||||
auto setting_desc = new wxStaticText(this, wxID_ANY, _u8L("Please note that modifying the extrusion multiplier parameter will affect different extrusion ratios.\nValid values area:0.9-1.1"),
|
||||
wxDefaultPosition, desc_size, wxALIGN_LEFT);
|
||||
setting_desc->Wrap(setting_desc->GetClientSize().x);
|
||||
setting_desc->SetForegroundColour(wxColour(*wxRED));
|
||||
|
||||
// delay
|
||||
start_length_sizer->Add(start_length_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
||||
start_length_sizer->Add(m_tiExtru, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
||||
settings_sizer->Add(start_length_sizer);
|
||||
|
||||
v_sizer->Add(settings_sizer);
|
||||
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
|
||||
v_sizer->Add(start_length_sizer);
|
||||
v_sizer->Add(setting_desc, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
||||
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
|
||||
m_btnStart = new Button(this, _L("OK"));
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(38, 166, 154), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal));
|
||||
StateColor btn_bg_blue(std::pair<wxColour, int>(wxColour(51, 91, 188), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(51, 109, 251), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(68, 121, 251), StateColor::Normal));
|
||||
|
||||
m_btnStart->SetBackgroundColor(btn_bg_green);
|
||||
m_btnStart->SetBorderColor(wxColour(0, 150, 136));
|
||||
m_btnStart->SetBackgroundColor(btn_bg_blue);
|
||||
m_btnStart->SetBorderColor(wxColour(68, 121, 251));
|
||||
m_btnStart->SetTextColor(wxColour("#FFFFFE"));
|
||||
m_btnStart->SetSize(wxSize(FromDIP(48), FromDIP(24)));
|
||||
m_btnStart->SetMinSize(wxSize(FromDIP(48), FromDIP(24)));
|
||||
@@ -92,9 +116,11 @@ void FRF_Calibration_Dlg::on_start(wxCommandEvent& event) {
|
||||
bool read_double = false;
|
||||
read_double = m_tiExtru->GetTextCtrl()->GetValue().ToDouble(&m_params.start);
|
||||
|
||||
if (!read_double || m_params.start <= 0 || m_params.start > 2) {
|
||||
MessageDialog msg_dlg(nullptr, _L("Please input valid values:\n0 < Extru <= 2.)"), wxEmptyString, wxICON_WARNING | wxOK);
|
||||
msg_dlg.ShowModal();
|
||||
if (!read_double || m_params.start < 0.9) {
|
||||
m_tiExtru->GetTextCtrl()->SetValue("0.9");
|
||||
return;
|
||||
} else if (!read_double || m_params.start > 1.1) {
|
||||
m_tiExtru->GetTextCtrl()->SetValue("1.1");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -178,9 +204,9 @@ PA_Calibration_Dlg::PA_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater*
|
||||
v_sizer->Add(settings_sizer);
|
||||
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
|
||||
m_btnStart = new Button(this, _L("OK"));
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(38, 166, 154), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal));
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(51, 91, 188), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(51, 109, 251), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(68, 121, 251), StateColor::Normal));
|
||||
|
||||
m_btnStart->SetBackgroundColor(btn_bg_green);
|
||||
m_btnStart->SetBorderColor(wxColour(0, 150, 136));
|
||||
|
||||
Reference in New Issue
Block a user