mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-13 02:19:01 +08:00
SPE-2501: Improve the notification about the bed temperature difference.
This commit is contained in:
parent
dcf26e1302
commit
d7a0dfd8e4
@ -974,6 +974,7 @@ public:
|
||||
// A scalar is nil, or all values of a vector are nil.
|
||||
bool is_nil() const override { for (auto v : this->values) if (v != nil_value()) return false; return true; }
|
||||
bool is_nil(size_t idx) const override { return values[idx < this->values.size() ? idx : 0] == nil_value(); }
|
||||
std::vector<int> getInts() const override { return this->values; }
|
||||
|
||||
std::string serialize() const override
|
||||
{
|
||||
|
@ -443,14 +443,19 @@ std::string Print::validate(std::vector<std::string>* warnings) const
|
||||
std::vector<unsigned int> extruders = this->extruders();
|
||||
|
||||
if (warnings) {
|
||||
for (size_t a=0; a<extruders.size(); ++a)
|
||||
for (size_t b=a+1; b<extruders.size(); ++b)
|
||||
if (std::abs(m_config.bed_temperature.get_at(extruders[a]) - m_config.bed_temperature.get_at(extruders[b])) > 15
|
||||
|| std::abs(m_config.first_layer_bed_temperature.get_at(extruders[a]) - m_config.first_layer_bed_temperature.get_at(extruders[b])) > 15) {
|
||||
warnings->emplace_back("_BED_TEMPS_DIFFER");
|
||||
goto DONE;
|
||||
if (m_config.bed_temperature_extruder == 0) {
|
||||
for (size_t a = 0; a < extruders.size(); ++a) {
|
||||
for (size_t b = a + 1; b < extruders.size(); ++b) {
|
||||
if (std::abs(m_config.bed_temperature.get_at(extruders[a]) - m_config.bed_temperature.get_at(extruders[b])) > 15
|
||||
|| std::abs(m_config.first_layer_bed_temperature.get_at(extruders[a]) - m_config.first_layer_bed_temperature.get_at(extruders[b])) > 15) {
|
||||
warnings->emplace_back("_BED_TEMPS_DIFFER");
|
||||
goto DONE;
|
||||
}
|
||||
}
|
||||
DONE:;
|
||||
}
|
||||
|
||||
DONE:;
|
||||
}
|
||||
|
||||
if (!this->has_same_shrinkage_compensations())
|
||||
warnings->emplace_back("_FILAMENT_SHRINKAGE_DIFFER");
|
||||
|
@ -608,7 +608,7 @@ public:
|
||||
// List of existing PrintObject IDs, to remove notifications for non-existent IDs.
|
||||
std::vector<ObjectID> print_object_ids() const override;
|
||||
|
||||
ApplyStatus apply(const Model &model, DynamicPrintConfig config) override;
|
||||
ApplyStatus apply(const Model &model, DynamicPrintConfig config, std::vector<std::string> *warnings = nullptr) override;
|
||||
void set_task(const TaskParams ¶ms) override { PrintBaseWithState<PrintStep, psCount>::set_task_impl(params, m_objects); }
|
||||
void process() override;
|
||||
void finalize() override { PrintBaseWithState<PrintStep, psCount>::finalize_impl(m_objects); }
|
||||
|
@ -1050,7 +1050,23 @@ static PrintObjectRegions* generate_print_object_regions(
|
||||
return out.release();
|
||||
}
|
||||
|
||||
Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_config)
|
||||
static void validate_print_config_change(const PrintConfig &old_config, const DynamicPrintConfig &new_config, std::vector<std::string> *warnings)
|
||||
{
|
||||
if (warnings == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (old_config.bed_temperature_extruder > 0 && old_config.bed_temperature_extruder == new_config.option("bed_temperature_extruder")->getInt()) {
|
||||
// Bed temperature extruder is set, and it didn't change with the new config.
|
||||
if (old_config.bed_temperature.values != new_config.option("bed_temperature")->getInts()
|
||||
|| old_config.first_layer_bed_temperature.values != new_config.option("first_layer_bed_temperature")->getInts()) {
|
||||
// When any bed temperature changes, we warn the user that the bed temperature extruder may need to be changed.
|
||||
warnings->emplace_back("_BED_TEMPS_CHANGED");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_config, std::vector<std::string> *warnings)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
check_model_ids_validity(model);
|
||||
@ -1076,6 +1092,9 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
||||
t_config_option_keys object_diff = m_default_object_config.diff(new_full_config);
|
||||
t_config_option_keys region_diff = m_default_region_config.diff(new_full_config);
|
||||
|
||||
// Check if the print config change will produce any warnings.
|
||||
validate_print_config_change(m_config, new_full_config, warnings);
|
||||
|
||||
// Do not use the ApplyStatus as we will use the max function when updating apply_status.
|
||||
unsigned int apply_status = APPLY_STATUS_UNCHANGED;
|
||||
auto update_apply_status = [&apply_status](bool invalidated)
|
||||
|
@ -433,7 +433,7 @@ public:
|
||||
// Some data was changed, which in turn invalidated already calculated steps.
|
||||
APPLY_STATUS_INVALIDATED,
|
||||
};
|
||||
virtual ApplyStatus apply(const Model &model, DynamicPrintConfig config) = 0;
|
||||
virtual ApplyStatus apply(const Model &model, DynamicPrintConfig config, std::vector<std::string> *warnings = nullptr) = 0;
|
||||
const Model& model() const { return m_model; }
|
||||
|
||||
struct TaskParams {
|
||||
|
@ -260,7 +260,7 @@ static t_config_option_keys print_config_diffs(const StaticPrintConfig &curr
|
||||
}
|
||||
|
||||
|
||||
SLAPrint::ApplyStatus SLAPrint::apply(const Model &model, DynamicPrintConfig config)
|
||||
SLAPrint::ApplyStatus SLAPrint::apply(const Model &model, DynamicPrintConfig config, std::vector<std::string> *warnings)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
check_model_ids_validity(model);
|
||||
|
@ -490,7 +490,7 @@ public:
|
||||
bool empty() const override { return m_objects.empty(); }
|
||||
// List of existing PrintObject IDs, to remove notifications for non-existent IDs.
|
||||
std::vector<ObjectID> print_object_ids() const override;
|
||||
ApplyStatus apply(const Model &model, DynamicPrintConfig config) override;
|
||||
ApplyStatus apply(const Model &model, DynamicPrintConfig config, std::vector<std::string> *warnings = nullptr) override;
|
||||
void set_task(const TaskParams ¶ms) override { PrintBaseWithState<SLAPrintStep, slapsCount>::set_task_impl(params, m_objects); }
|
||||
void process() override;
|
||||
void finalize() override { PrintBaseWithState<SLAPrintStep, slapsCount>::finalize_impl(m_objects); }
|
||||
|
@ -590,11 +590,11 @@ std::string BackgroundSlicingProcess::validate(std::vector<std::string>* warning
|
||||
|
||||
// Apply config over the print. Returns false, if the new config values caused any of the already
|
||||
// processed steps to be invalidated, therefore the task will need to be restarted.
|
||||
Print::ApplyStatus BackgroundSlicingProcess::apply(const Model &model, const DynamicPrintConfig &config)
|
||||
Print::ApplyStatus BackgroundSlicingProcess::apply(const Model &model, const DynamicPrintConfig &config, std::vector<std::string> *warnings)
|
||||
{
|
||||
assert(m_print != nullptr);
|
||||
assert(config.opt_enum<PrinterTechnology>("printer_technology") == m_print->technology());
|
||||
Print::ApplyStatus invalidated = m_print->apply(model, config);
|
||||
Print::ApplyStatus invalidated = m_print->apply(model, config, warnings);
|
||||
if ((invalidated & PrintBase::APPLY_STATUS_INVALIDATED) != 0 && m_print->technology() == ptFFF &&
|
||||
!m_fff_print->is_step_done(psGCodeExport)) {
|
||||
// Some FFF status was invalidated, and the G-code was not exported yet.
|
||||
|
@ -133,7 +133,7 @@ public:
|
||||
|
||||
// Apply config over the print. Returns false, if the new config values caused any of the already
|
||||
// processed steps to be invalidated, therefore the task will need to be restarted.
|
||||
PrintBase::ApplyStatus apply(const Model &model, const DynamicPrintConfig &config);
|
||||
PrintBase::ApplyStatus apply(const Model &model, const DynamicPrintConfig &config, std::vector<std::string> *warnings = nullptr);
|
||||
// After calling the apply() function, set_task() may be called to limit the task to be processed by process().
|
||||
// This is useful for calculating SLA supports for a single object only.
|
||||
void set_task(const PrintBase::TaskParams ¶ms);
|
||||
|
@ -968,7 +968,7 @@ void Plater::priv::init()
|
||||
this->notification_manager->close_notification_of_type(NotificationType::UserAccountID);
|
||||
// show connect tab
|
||||
this->notification_manager->push_notification(NotificationType::UserAccountID, NotificationManager::NotificationLevel::ImportantNotificationLevel, text);
|
||||
|
||||
|
||||
this->main_frame->on_account_login(user_account->get_access_token());
|
||||
} else {
|
||||
// refresh do different operations than on_account_login
|
||||
@ -1060,11 +1060,11 @@ void Plater::priv::init()
|
||||
|
||||
this->q->Bind(EVT_UA_REFRESH_TIME, [this](UserAccountTimeEvent& evt) {
|
||||
this->user_account->set_refresh_time(evt.data);
|
||||
});
|
||||
});
|
||||
this->q->Bind(EVT_UA_ENQUEUED_REFRESH, [this](SimpleEvent& evt) {
|
||||
this->main_frame->on_account_will_refresh();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
this->q->Bind(EVT_PRINTABLES_CONNECT_PRINT, [this](wxCommandEvent& evt) {
|
||||
if (!this->user_account->is_logged()) {
|
||||
// show login dialog instead of print dialog
|
||||
@ -1287,7 +1287,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||
#ifdef __linux__
|
||||
// On Linux Constructor of the ProgressDialog calls DisableOtherWindows() function which causes a disabling of all children of the find_toplevel_parent(q)
|
||||
// And a destructor of the ProgressDialog calls ReenableOtherWindows() function which revert previously disabled children.
|
||||
// But if printer technology will be changes during project loading,
|
||||
// But if printer technology will be changes during project loading,
|
||||
// then related SLA Print and Materials Settings or FFF Print and Filaments Settings will be unparent from the wxNoteBook
|
||||
// and that is why they will never be enabled after destruction of the ProgressDialog.
|
||||
// So, distroy progress_gialog if we are loading project file
|
||||
@ -1365,8 +1365,8 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||
|
||||
// For exporting from the 3mf we shouldn't check printer_presets for the containing information about "Print Host upload"
|
||||
wxGetApp().load_current_presets(false);
|
||||
// Update filament colors for the MM-printer profile in the full config
|
||||
// to avoid black (default) colors for Extruders in the ObjectList,
|
||||
// Update filament colors for the MM-printer profile in the full config
|
||||
// to avoid black (default) colors for Extruders in the ObjectList,
|
||||
// when for extruder colors are used filament colors
|
||||
q->update_filament_colors_in_full_config();
|
||||
is_project_file = true;
|
||||
@ -2131,9 +2131,16 @@ void Plater::priv::process_validation_warning(const std::vector<std::string>& wa
|
||||
print_tab->on_value_change("support_material_auto", config.opt_bool("support_material_auto"));
|
||||
return true;
|
||||
};
|
||||
} else if (text == "_BED_TEMPS_DIFFER") {
|
||||
text = _u8L("Bed temperatures for the used filaments differ significantly.");
|
||||
} else if (text == "_BED_TEMPS_DIFFER" || text == "_BED_TEMPS_CHANGED") {
|
||||
text = _u8L("Bed temperatures for the used filaments differ significantly.\n"
|
||||
"For multi-material prints it is recommended to set the ");
|
||||
hypertext = _u8L("'Bed temperature by extruder' and 'Wipe tower extruder'");
|
||||
multiline = true;
|
||||
notification_type = NotificationType::BedTemperaturesDiffer;
|
||||
action_fn = [](wxEvtHandler*) {
|
||||
GUI::wxGetApp().jump_to_option("bed_temperature_extruder", Preset::Type::TYPE_PRINT, boost::nowide::widen("Multiple Extruders"));
|
||||
return true;
|
||||
};
|
||||
} else if (text == "_FILAMENT_SHRINKAGE_DIFFER") {
|
||||
text = _u8L("Filament shrinkage will not be used because filament shrinkage "
|
||||
"for the used filaments differs significantly.");
|
||||
@ -2290,15 +2297,16 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
|
||||
std::vector<Print::ApplyStatus>(1)
|
||||
};
|
||||
|
||||
// Apply new config to the possibly running background task.
|
||||
std::vector<std::string> warnings;
|
||||
// Apply new config to the possibly running background task and give the user feedback on warnings.
|
||||
if (printer_technology == ptFFF) {
|
||||
with_single_bed_model_fff(q->model(), s_multiple_beds.get_active_bed(), [&](){
|
||||
invalidated = background_process.apply(q->model(), full_config);
|
||||
invalidated = background_process.apply(q->model(), full_config, &warnings);
|
||||
apply_statuses[s_multiple_beds.get_active_bed()] = invalidated;
|
||||
});
|
||||
} else if (printer_technology == ptSLA) {
|
||||
with_single_bed_model_sla(q->model(), s_multiple_beds.get_active_bed(), [&](){
|
||||
invalidated = background_process.apply(q->model(), full_config);
|
||||
invalidated = background_process.apply(q->model(), full_config, &warnings);
|
||||
apply_statuses[0] = invalidated;
|
||||
});
|
||||
} else {
|
||||
@ -2378,7 +2386,6 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
|
||||
// The delayed error message is no more valid.
|
||||
delayed_error_message.clear();
|
||||
// The state of the Print changed, and it is non-zero. Let's validate it and give the user feedback on errors.
|
||||
std::vector<std::string> warnings;
|
||||
std::string err = background_process.validate(&warnings);
|
||||
if (err.empty()) {
|
||||
notification_manager->set_all_slicing_errors_gray(true);
|
||||
@ -3170,16 +3177,16 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)
|
||||
std::vector<ObjectID> object_ids = { evt.status.warning_object_id };
|
||||
std::vector<int> warning_steps = { evt.status.warning_step };
|
||||
std::vector<int> flagss = { int(evt.status.flags) };
|
||||
|
||||
|
||||
if (warning_steps.front() == -1) {
|
||||
flagss = { PrintBase::SlicingStatus::UPDATE_PRINT_STEP_WARNINGS, PrintBase::SlicingStatus::UPDATE_PRINT_OBJECT_STEP_WARNINGS };
|
||||
notification_manager->close_slicing_errors_and_warnings();
|
||||
}
|
||||
|
||||
|
||||
for (int flags : flagss ) {
|
||||
if (warning_steps.front() == -1) {
|
||||
warning_steps.clear();
|
||||
if (flags == PrintBase::SlicingStatus::UPDATE_PRINT_STEP_WARNINGS) {
|
||||
if (flags == PrintBase::SlicingStatus::UPDATE_PRINT_STEP_WARNINGS) {
|
||||
int i = 0;
|
||||
while (i < int(printer_technology == ptFFF ? psCount : slapsCount)) { warning_steps.push_back(i); ++i; }
|
||||
} else {
|
||||
@ -5242,7 +5249,7 @@ bool Plater::load_files(const wxArrayString& filenames, bool delete_after_load/*
|
||||
return true;
|
||||
} else if (boost::algorithm::iends_with(filename, ".zip")) {
|
||||
if (!load_just_one_file) {
|
||||
WarningDialog dlg(static_cast<wxWindow*>(this),
|
||||
WarningDialog dlg(static_cast<wxWindow*>(this),
|
||||
format_wxstr(_L("You have several files for loading and \"%1%\" is one of them.\n"
|
||||
"Please note that only one .zip file can be loaded at a time.\n"
|
||||
"In this case we can load just \"%1%\".\n\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user