diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index d22677c95..50933a972 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -1103,7 +1103,7 @@ wxWindow *SelectMachineDialog::create_ams_checkbox(wxString title, wxWindow *par checkbox->SetToolTip(tooltip); text->SetToolTip(tooltip); - text->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &) { + text->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent & event) { ams_check->SetValue(ams_check->GetValue() ? false : true); }); return checkbox; @@ -1200,6 +1200,16 @@ void SelectMachineDialog::finish_mode() void SelectMachineDialog::sync_ams_mapping_result(std::vector &result) { + if (result.empty()) { + BOOST_LOG_TRIVIAL(trace) << "ams_mapping result is empty"; + for (auto it = m_materialList.begin(); it != m_materialList.end(); it++) { + wxString ams_id = "-"; + wxColour ams_col = wxColour(0xCE, 0xCE, 0xCE); + it->second->item->set_ams_info(ams_col, ams_id); + } + return; + } + for (auto f = result.begin(); f != result.end(); f++) { BOOST_LOG_TRIVIAL(trace) << "ams_mapping f id = " << f->id << ", tray_id = " << f->tray_id << ", color = " << f->color << ", type = " << f->type; @@ -1470,7 +1480,7 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vectorams_support_use_ams) { if (!ams_check->GetValue()) { m_ams_mapping_result.clear(); + sync_ams_mapping_result(m_ams_mapping_result); show_status(PrintDialogStatus::PrintStatusDisableAms); return; } @@ -2259,7 +2270,7 @@ void SelectMachineDialog::set_default() pos.y += item->GetRect().height; m_mapping_popup.Position(pos, wxSize(0, 0)); - if (obj_ && obj_->has_ams()) { + if (obj_ && obj_->has_ams() && ams_check->GetValue()) { m_mapping_popup.set_current_filament_id(extruder); m_mapping_popup.set_tag_texture(materials[extruder]); m_mapping_popup.update_ams_data(obj_->amsList); diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index cc6c81c10..b70311bd7 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -1950,6 +1950,15 @@ void StatusPanel::reset_printing_values() void StatusPanel::on_axis_ctrl_xy(wxCommandEvent &event) { if (!obj) return; + if (event.GetInt() == 0) { obj->command_axis_control("Y", 1.0, 10.0f, 3000); } + if (event.GetInt() == 1) { obj->command_axis_control("X", 1.0, -10.0f, 3000); } + if (event.GetInt() == 2) { obj->command_axis_control("Y", 1.0, -10.0f, 3000); } + if (event.GetInt() == 3) { obj->command_axis_control("X", 1.0, 10.0f, 3000); } + if (event.GetInt() == 4) { obj->command_axis_control("Y", 1.0, 1.0f, 3000); } + if (event.GetInt() == 5) { obj->command_axis_control("X", 1.0, -1.0f, 3000); } + if (event.GetInt() == 6) { obj->command_axis_control("Y", 1.0, -1.0f, 3000); } + if (event.GetInt() == 7) { obj->command_axis_control("X", 1.0, 1.0f, 3000); } + if (event.GetInt() == 8) { obj->command_go_home(); } //check is at home if (event.GetInt() == 1 @@ -1961,25 +1970,17 @@ void StatusPanel::on_axis_ctrl_xy(wxCommandEvent &event) show_recenter_dialog(); return; } - } else if (event.GetInt() == 0 - || event.GetInt() == 2 - || event.GetInt() == 4 - || event.GetInt() == 6) { + } + else if (event.GetInt() == 0 + || event.GetInt() == 2 + || event.GetInt() == 4 + || event.GetInt() == 6) { if (!obj->is_axis_at_home("Y")) { BOOST_LOG_TRIVIAL(info) << "axis y is not at home"; show_recenter_dialog(); return; } } - if (event.GetInt() == 0) { obj->command_axis_control("Y", 1.0, 10.0f, 3000); } - if (event.GetInt() == 1) { obj->command_axis_control("X", 1.0, -10.0f, 3000); } - if (event.GetInt() == 2) { obj->command_axis_control("Y", 1.0, -10.0f, 3000); } - if (event.GetInt() == 3) { obj->command_axis_control("X", 1.0, 10.0f, 3000); } - if (event.GetInt() == 4) { obj->command_axis_control("Y", 1.0, 1.0f, 3000); } - if (event.GetInt() == 5) { obj->command_axis_control("X", 1.0, -1.0f, 3000); } - if (event.GetInt() == 6) { obj->command_axis_control("Y", 1.0, -1.0f, 3000); } - if (event.GetInt() == 7) { obj->command_axis_control("X", 1.0, 1.0f, 3000); } - if (event.GetInt() == 8) { obj->command_go_home(); } } bool StatusPanel::check_axis_z_at_home(MachineObject* obj) @@ -1998,36 +1999,36 @@ bool StatusPanel::check_axis_z_at_home(MachineObject* obj) void StatusPanel::on_axis_ctrl_z_up_10(wxCommandEvent &event) { if (obj) { + obj->command_axis_control("Z", 1.0, -10.0f, 900); if (!check_axis_z_at_home(obj)) return; - obj->command_axis_control("Z", 1.0, -10.0f, 900); } } void StatusPanel::on_axis_ctrl_z_up_1(wxCommandEvent &event) { if (obj) { + obj->command_axis_control("Z", 1.0, -1.0f, 900); if (!check_axis_z_at_home(obj)) return; - obj->command_axis_control("Z", 1.0, -1.0f, 900); } } void StatusPanel::on_axis_ctrl_z_down_1(wxCommandEvent &event) { if (obj) { + obj->command_axis_control("Z", 1.0, 1.0f, 900); if (!check_axis_z_at_home(obj)) return; - obj->command_axis_control("Z", 1.0, 1.0f, 900); } } void StatusPanel::on_axis_ctrl_z_down_10(wxCommandEvent &event) { if (obj) { + obj->command_axis_control("Z", 1.0, 10.0f, 900); if (!check_axis_z_at_home(obj)) return; - obj->command_axis_control("Z", 1.0, 10.0f, 900); } }