ENH: Allow machines that do not support timelapse

STUDIO-3935

Change-Id: I8b65c1d24fdee744af10d4112b0f8bee7554ad3c
(cherry picked from commit 1802c2e8c4fc68fce3dc5b025814aec84e7653a3)
This commit is contained in:
zhimin.zeng 2023-08-14 16:36:11 +08:00 committed by Lane.Wei
parent 7a7dcb1de2
commit 144abfca27
3 changed files with 57 additions and 4 deletions

View file

@ -281,6 +281,7 @@ static constexpr const char* PLATER_NAME_ATTR = "plater_name";
static constexpr const char* PLATE_IDX_ATTR = "index"; static constexpr const char* PLATE_IDX_ATTR = "index";
static constexpr const char* SLICE_PREDICTION_ATTR = "prediction"; static constexpr const char* SLICE_PREDICTION_ATTR = "prediction";
static constexpr const char* SLICE_WEIGHT_ATTR = "weight"; static constexpr const char* SLICE_WEIGHT_ATTR = "weight";
static constexpr const char* TIMELAPSE_TYPE_ATTR = "timelapse_type";
static constexpr const char* OUTSIDE_ATTR = "outside"; static constexpr const char* OUTSIDE_ATTR = "outside";
static constexpr const char* SUPPORT_USED_ATTR = "support_used"; static constexpr const char* SUPPORT_USED_ATTR = "support_used";
static constexpr const char* LABEL_OBJECT_ENABLED_ATTR = "label_object_enabled"; static constexpr const char* LABEL_OBJECT_ENABLED_ATTR = "label_object_enabled";
@ -5241,7 +5242,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
bool _add_project_embedded_presets_to_archive(mz_zip_archive& archive, Model& model, std::vector<Preset*> project_presets); bool _add_project_embedded_presets_to_archive(mz_zip_archive& archive, Model& model, std::vector<Preset*> project_presets);
bool _add_model_config_file_to_archive(mz_zip_archive& archive, const Model& model, PlateDataPtrs& plate_data_list, const ObjectToObjectDataMap &objects_data, int export_plate_idx = -1, bool save_gcode = true, bool use_loaded_id = false); bool _add_model_config_file_to_archive(mz_zip_archive& archive, const Model& model, PlateDataPtrs& plate_data_list, const ObjectToObjectDataMap &objects_data, int export_plate_idx = -1, bool save_gcode = true, bool use_loaded_id = false);
bool _add_cut_information_file_to_archive(mz_zip_archive &archive, Model &model); bool _add_cut_information_file_to_archive(mz_zip_archive &archive, Model &model);
bool _add_slice_info_config_file_to_archive(mz_zip_archive &archive, const Model &model, PlateDataPtrs &plate_data_list, const ObjectToObjectDataMap &objects_data); bool _add_slice_info_config_file_to_archive(mz_zip_archive &archive, const Model &model, PlateDataPtrs &plate_data_list, const ObjectToObjectDataMap &objects_data, const DynamicPrintConfig& config);
bool _add_gcode_file_to_archive(mz_zip_archive& archive, const Model& model, PlateDataPtrs& plate_data_list, Export3mfProgressFn proFn = nullptr); bool _add_gcode_file_to_archive(mz_zip_archive& archive, const Model& model, PlateDataPtrs& plate_data_list, Export3mfProgressFn proFn = nullptr);
bool _add_custom_gcode_per_print_z_file_to_archive(mz_zip_archive& archive, Model& model, const DynamicPrintConfig* config); bool _add_custom_gcode_per_print_z_file_to_archive(mz_zip_archive& archive, Model& model, const DynamicPrintConfig* config);
bool _add_auxiliary_dir_to_archive(mz_zip_archive &archive, const std::string &aux_dir, PackingTemporaryData &data); bool _add_auxiliary_dir_to_archive(mz_zip_archive &archive, const std::string &aux_dir, PackingTemporaryData &data);
@ -5743,7 +5744,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
// Adds sliced info of plate file ("Metadata/slice_info.config") // Adds sliced info of plate file ("Metadata/slice_info.config")
// This file contains all sliced info of all plates // This file contains all sliced info of all plates
if (!_add_slice_info_config_file_to_archive(archive, model, plate_data_list, objects_data)) { if (!_add_slice_info_config_file_to_archive(archive, model, plate_data_list, objects_data, *config)) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":" << __LINE__ << boost::format(", _add_slice_info_config_file_to_archive failed\n"); BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":" << __LINE__ << boost::format(", _add_slice_info_config_file_to_archive failed\n");
return false; return false;
} }
@ -7257,7 +7258,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
return true; return true;
} }
bool _BBS_3MF_Exporter::_add_slice_info_config_file_to_archive(mz_zip_archive& archive, const Model& model, PlateDataPtrs& plate_data_list, const ObjectToObjectDataMap &objects_data) bool _BBS_3MF_Exporter::_add_slice_info_config_file_to_archive(mz_zip_archive& archive, const Model& model, PlateDataPtrs& plate_data_list, const ObjectToObjectDataMap &objects_data, const DynamicPrintConfig& config)
{ {
std::stringstream stream; std::stringstream stream;
// Store mesh transformation in full precision, as the volumes are stored transformed and they need to be transformed back // Store mesh transformation in full precision, as the volumes are stored transformed and they need to be transformed back
@ -7282,6 +7283,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
stream << " <" << PLATE_TAG << ">\n"; stream << " <" << PLATE_TAG << ">\n";
//plate index //plate index
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << PLATE_IDX_ATTR << "\" " << VALUE_ATTR << "=\"" << plate_data->plate_index + 1 << "\"/>\n"; stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << PLATE_IDX_ATTR << "\" " << VALUE_ATTR << "=\"" << plate_data->plate_index + 1 << "\"/>\n";
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << TIMELAPSE_TYPE_ATTR << "\" " << VALUE_ATTR << "=\"" << int(config.opt_enum<TimelapseType>("timelapse_type")) << "\"/>\n";
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << SLICE_PREDICTION_ATTR << "\" " << VALUE_ATTR << "=\"" << plate_data->get_gcode_prediction_str() << "\"/>\n"; stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << SLICE_PREDICTION_ATTR << "\" " << VALUE_ATTR << "=\"" << plate_data->get_gcode_prediction_str() << "\"/>\n";
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << SLICE_WEIGHT_ATTR << "\" " << VALUE_ATTR << "=\"" << plate_data->get_gcode_weight_str() << "\"/>\n"; stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << SLICE_WEIGHT_ATTR << "\" " << VALUE_ATTR << "=\"" << plate_data->get_gcode_weight_str() << "\"/>\n";
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << OUTSIDE_ATTR << "\" " << VALUE_ATTR << "=\"" << std::boolalpha<< plate_data->toolpath_outside << "\"/>\n"; stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << OUTSIDE_ATTR << "\" " << VALUE_ATTR << "=\"" << std::boolalpha<< plate_data->toolpath_outside << "\"/>\n";

View file

@ -1673,6 +1673,7 @@ void SelectMachineDialog::update_select_layout(MachineObject *obj)
&& obj->is_support_print_with_timelapse() && obj->is_support_print_with_timelapse()
&& is_show_timelapse()) { && is_show_timelapse()) {
select_timelapse->Show(); select_timelapse->Show();
set_timelapse_enable_status();
} else { } else {
select_timelapse->Hide(); select_timelapse->Hide();
} }
@ -2161,6 +2162,11 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
update_print_status_msg(msg_text, true, true); update_print_status_msg(msg_text, true, true);
Enable_Send_Button(false); Enable_Send_Button(false);
Enable_Refresh_Button(true); Enable_Refresh_Button(true);
} else if (status == PrintDialogStatus::PrintStatusUnsupportedSelectedTimelapse) {
wxString msg_text = _L("This printer does not support selected timelapse mode, you can change the timelapse mode");
update_print_status_msg(msg_text, true, true);
Enable_Send_Button(true);
Enable_Refresh_Button(true);
} }
} }
@ -3164,6 +3170,10 @@ void SelectMachineDialog::update_show_status()
show_status(PrintDialogStatus::PrintStatusNoSdcard); show_status(PrintDialogStatus::PrintStatusNoSdcard);
return; return;
} }
else if (!is_enable_timelapse()) {
show_status(PrintDialogStatus::PrintStatusUnsupportedSelectedTimelapse);
return;
}
// check sdcard when if lan mode printer // check sdcard when if lan mode printer
if (obj_->is_lan_mode_printer()) { if (obj_->is_lan_mode_printer()) {
@ -3239,6 +3249,44 @@ void SelectMachineDialog::update_show_status()
} }
} }
void SelectMachineDialog::set_timelapse_enable_status()
{
AppConfig *config = wxGetApp().app_config;
if (is_enable_timelapse()) {
if (!config || config->get("print", "timelapse") == "0")
m_checkbox_list["timelapse"]->SetValue(false);
else
m_checkbox_list["timelapse"]->SetValue(true);
select_timelapse->Enable(true);
} else {
m_checkbox_list["timelapse"]->SetValue(false);
select_timelapse->Enable(false);
if (config) {
config->set_str("print", "timelapse", "0");
}
}
}
bool SelectMachineDialog::is_enable_timelapse()
{
if (auto op_timelapse_type = wxGetApp().preset_bundle->prints.get_edited_preset().config.option<ConfigOptionEnum<TimelapseType>>("timelapse_type"))
{
DeviceManager *dev_manager = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev_manager)
return false;
MachineObject *cur_machine_obj = dev_manager->get_selected_machine();
if (!cur_machine_obj)
return false;
TimelapseType cur_timelapse_type = op_timelapse_type->value;
if (cur_timelapse_type == TimelapseType::tlTraditional && cur_machine_obj->get_printer_arch() == PrinterArch::ARCH_I3) {
return false;
}
}
return true;
}
bool SelectMachineDialog::is_show_timelapse() bool SelectMachineDialog::is_show_timelapse()
{ {
auto compare_version = [](const std::string &version1, const std::string &version2) -> bool { auto compare_version = [](const std::string &version1, const std::string &version2) -> bool {

View file

@ -272,7 +272,8 @@ enum PrintDialogStatus {
PrintStatusNotSupportedSendToSDCard, PrintStatusNotSupportedSendToSDCard,
PrintStatusNotSupportedPrintAll, PrintStatusNotSupportedPrintAll,
PrintStatusBlankPlate, PrintStatusBlankPlate,
PrintStatusUnsupportedPrinter PrintStatusUnsupportedPrinter,
PrintStatusUnsupportedSelectedTimelapse,
}; };
std::string get_print_status_info(PrintDialogStatus status); std::string get_print_status_info(PrintDialogStatus status);
@ -442,7 +443,9 @@ public:
void update_print_status_msg(wxString msg, bool is_warning = false, bool is_printer = true); void update_print_status_msg(wxString msg, bool is_warning = false, bool is_printer = true);
void update_print_error_info(int code, std::string msg, std::string extra); void update_print_error_info(int code, std::string msg, std::string extra);
void set_flow_calibration_state(bool state); void set_flow_calibration_state(bool state);
bool is_enable_timelapse();
bool is_show_timelapse(); bool is_show_timelapse();
void set_timelapse_enable_status();
bool is_same_printer_model(); bool is_same_printer_model();
bool is_blocking_printing(); bool is_blocking_printing();
bool has_tips(MachineObject* obj); bool has_tips(MachineObject* obj);