mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-13 19:35:57 +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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user