FIX: allow smooth timelapse without wipe tower

Change-Id: I60d487faa96641dbf88f5502d2fa9ccb83e622c6
(cherry picked from commit 0286a7add9c698a2efd6d40910d72a83f06edba5)
This commit is contained in:
zhimin.zeng 2022-10-13 13:23:08 +08:00 committed by Lane.Wei
parent a3dcc40f23
commit f996eedf49
5 changed files with 14 additions and 27 deletions

View file

@ -1730,13 +1730,13 @@ void Print::finalize_first_layer_convex_hull()
// Wipe tower support. // Wipe tower support.
bool Print::has_wipe_tower() const bool Print::has_wipe_tower() const
{ {
if (m_config.enable_prime_tower.value == true) {
if (enable_timelapse_print()) if (enable_timelapse_print())
return true; return true;
return return !m_config.spiral_mode.value && m_config.filament_diameter.values.size() > 1;
! m_config.spiral_mode.value && }
m_config.enable_prime_tower.value && return false;
m_config.filament_diameter.values.size() > 1;
} }
const WipeTowerData& Print::wipe_tower_data(size_t filaments_cnt) const const WipeTowerData& Print::wipe_tower_data(size_t filaments_cnt) const

View file

@ -3728,10 +3728,7 @@ void DynamicPrintConfig::normalize_fdm(int used_filaments)
ConfigOptionEnum<TimelapseType>* timelapse_opt = this->option<ConfigOptionEnum<TimelapseType>>("timelapse_type"); ConfigOptionEnum<TimelapseType>* timelapse_opt = this->option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
bool is_smooth_timelapse = timelapse_opt != nullptr && timelapse_opt->value == TimelapseType::tlSmooth; bool is_smooth_timelapse = timelapse_opt != nullptr && timelapse_opt->value == TimelapseType::tlSmooth;
if (is_smooth_timelapse) { if (!is_smooth_timelapse && (used_filaments == 1 || ps_opt->value == PrintSequence::ByObject)) {
ept_opt->value = true;
}
else if (used_filaments == 1 || ps_opt->value == PrintSequence::ByObject) {
ept_opt->value = false; ept_opt->value = false;
} }

View file

@ -3085,8 +3085,8 @@ void GCodeViewer::load_shells(const Print& print, bool initialized, bool force_p
const double max_z = print.objects()[0]->model_object()->get_model()->bounding_box().max(2); const double max_z = print.objects()[0]->model_object()->get_model()->bounding_box().max(2);
const PrintConfig& config = print.config(); const PrintConfig& config = print.config();
if (print.enable_timelapse_print() if (config.enable_prime_tower &&
|| (extruders_count > 1 && config.enable_prime_tower && (config.print_sequence == PrintSequence::ByLayer))) { (print.enable_timelapse_print() || (extruders_count > 1 && (config.print_sequence == PrintSequence::ByLayer)))) {
const float depth = print.wipe_tower_data(extruders_count).depth; const float depth = print.wipe_tower_data(extruders_count).depth;
const float brim_width = print.wipe_tower_data(extruders_count).brim_width; const float brim_width = print.wipe_tower_data(extruders_count).brim_width;

View file

@ -1935,7 +1935,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
auto timelapse_type = dconfig.option<ConfigOptionEnum<TimelapseType>>("timelapse_type"); auto timelapse_type = dconfig.option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
bool timelapse_enabled = timelapse_type ? (timelapse_type->value == TimelapseType::tlSmooth) : false; bool timelapse_enabled = timelapse_type ? (timelapse_type->value == TimelapseType::tlSmooth) : false;
if (timelapse_enabled || (filaments_count > 1 && wt && co != nullptr && co->value != PrintSequence::ByObject)) { if ((timelapse_enabled && wt) || (filaments_count > 1 && wt && co != nullptr && co->value != PrintSequence::ByObject)) {
for (int plate_id = 0; plate_id < n_plates; plate_id++) { for (int plate_id = 0; plate_id < n_plates; plate_id++) {
DynamicPrintConfig& proj_cfg = wxGetApp().preset_bundle->project_config; DynamicPrintConfig& proj_cfg = wxGetApp().preset_bundle->project_config;
float x = dynamic_cast<const ConfigOptionFloats*>(proj_cfg.option("wipe_tower_x"))->get_at(plate_id); float x = dynamic_cast<const ConfigOptionFloats*>(proj_cfg.option("wipe_tower_x"))->get_at(plate_id);

View file

@ -1380,19 +1380,14 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
auto timelapse_type = m_config->option<ConfigOptionEnum<TimelapseType>>("timelapse_type"); auto timelapse_type = m_config->option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
bool timelapse_enabled = timelapse_type->value == TimelapseType::tlSmooth; bool timelapse_enabled = timelapse_type->value == TimelapseType::tlSmooth;
if (!boost::any_cast<bool>(value) && timelapse_enabled) { if (!boost::any_cast<bool>(value) && timelapse_enabled) {
MessageDialog dlg(wxGetApp().plater(), _L("Prime tower is required by timeplase. Are you sure you want to disable both of them?"), MessageDialog dlg(wxGetApp().plater(), _L("Prime tower is required by smooth timeplase. If whthout prime tower, there will be flaws on the model. Are you sure you want to disable prime tower?"),
_L("Warning"), wxICON_WARNING | wxYES | wxNO); _L("Warning"), wxICON_WARNING | wxYES | wxNO);
if (dlg.ShowModal() == wxID_YES) { if (dlg.ShowModal() == wxID_NO) {
DynamicPrintConfig new_conf = *m_config;
new_conf.set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(TimelapseType::tlNone));
m_config_manipulation.apply(m_config, &new_conf);
wxGetApp().plater()->update();
}
else {
DynamicPrintConfig new_conf = *m_config; DynamicPrintConfig new_conf = *m_config;
new_conf.set_key_value("enable_prime_tower", new ConfigOptionBool(true)); new_conf.set_key_value("enable_prime_tower", new ConfigOptionBool(true));
m_config_manipulation.apply(m_config, &new_conf); m_config_manipulation.apply(m_config, &new_conf);
} }
wxGetApp().plater()->update();
} }
update_wiping_button_visibility(); update_wiping_button_visibility();
} }
@ -1401,7 +1396,7 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
if (opt_key == "timelapse_type") { if (opt_key == "timelapse_type") {
bool wipe_tower_enabled = m_config->option<ConfigOptionBool>("enable_prime_tower")->value; bool wipe_tower_enabled = m_config->option<ConfigOptionBool>("enable_prime_tower")->value;
if (!wipe_tower_enabled && boost::any_cast<int>(value) == int(TimelapseType::tlSmooth)) { if (!wipe_tower_enabled && boost::any_cast<int>(value) == int(TimelapseType::tlSmooth)) {
MessageDialog dlg(wxGetApp().plater(), _L("Prime tower is required by timelapse. Do you want to enable both of them?"), MessageDialog dlg(wxGetApp().plater(), _L("Prime tower is required by smooth timelapse. If whthout prime tower, there will be flaws on the model. Do you want to enable prime tower?"),
_L("Warning"), wxICON_WARNING | wxYES | wxNO); _L("Warning"), wxICON_WARNING | wxYES | wxNO);
if (dlg.ShowModal() == wxID_YES) { if (dlg.ShowModal() == wxID_YES) {
DynamicPrintConfig new_conf = *m_config; DynamicPrintConfig new_conf = *m_config;
@ -1409,11 +1404,6 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
m_config_manipulation.apply(m_config, &new_conf); m_config_manipulation.apply(m_config, &new_conf);
wxGetApp().plater()->update(); wxGetApp().plater()->update();
} }
else {
DynamicPrintConfig new_conf = *m_config;
new_conf.set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(TimelapseType::tlNone));
m_config_manipulation.apply(m_config, &new_conf);
}
} else { } else {
wxGetApp().plater()->update(); wxGetApp().plater()->update();
} }