Add a notification when custom support enforcers are not used due to supports being off

It is now emitted from Print::validate and has a hyperlink to enable supports
This commit is contained in:
Lukas Matena 2021-02-26 08:23:37 +01:00
parent a7255235e5
commit abd5a9a46e
10 changed files with 89 additions and 11 deletions

View file

@ -1245,7 +1245,7 @@ static inline bool sequential_print_vertical_clearance_valid(const Print &print)
}
// Precondition: Print::validate() requires the Print::apply() to be called its invocation.
std::string Print::validate() const
std::string Print::validate(std::string* warning) const
{
if (m_objects.empty())
return L("All objects are outside of the print volume.");
@ -1440,7 +1440,22 @@ std::string Print::validate() const
}
}
}
// Do we have custom support data that would not be used?
// Notify the user in that case.
if (! object->has_support() && warning) {
for (const ModelVolume* mv : object->model_object()->volumes) {
bool has_enforcers = mv->is_support_enforcer()
|| (mv->is_model_part()
&& ! mv->supported_facets.empty()
&& ! mv->supported_facets.get_facets(*mv, EnforcerBlockerType::ENFORCER).indices.empty());
if (has_enforcers) {
*warning = "_SUPPORTS_OFF";
break;
}
}
}
// validate first_layer_height
double first_layer_height = object->config().get_abs_value("first_layer_height");
double first_layer_min_nozzle_diameter;

View file

@ -444,7 +444,7 @@ public:
bool has_brim() const;
// Returns an empty string if valid, otherwise returns an error message.
std::string validate() const override;
std::string validate(std::string* warning = nullptr) const override;
double skirt_first_layer_height() const;
Flow brim_flow() const;
Flow skirt_flow() const;

View file

@ -366,7 +366,7 @@ public:
virtual std::vector<ObjectID> print_object_ids() const = 0;
// Validate the print, return empty string if valid, return error if process() cannot (or should not) be started.
virtual std::string validate() const { return std::string(); }
virtual std::string validate(std::string* warning = nullptr) const { return std::string(); }
enum ApplyStatus {
// No change after the Print::apply() call.

View file

@ -430,6 +430,24 @@ void PrintObject::generate_support_material()
if (layer->empty())
throw Slic3r::SlicingError("Levitating objects cannot be printed without supports.");
#endif
// Do we have custom support data that would not be used?
// Notify the user in that case.
if (! this->has_support()) {
for (const ModelVolume* mv : this->model_object()->volumes) {
bool has_enforcers = mv->is_support_enforcer()
|| (mv->is_model_part()
&& ! mv->supported_facets.empty()
&& ! mv->supported_facets.get_facets(*mv, EnforcerBlockerType::ENFORCER).indices.empty());
if (has_enforcers) {
this->active_step_add_warning(PrintStateBase::WarningLevel::CRITICAL,
L("An object has custom support enforcers which will not be used "
"because supports are off. Consider turning them on.") + "\n" +
(L("Object name")) + ": " + this->model_object()->name);
break;
}
}
}
}
this->set_done(posSupportMaterial);
}

View file

@ -617,7 +617,7 @@ std::string SLAPrint::output_filename(const std::string &filename_base) const
return this->PrintBase::output_filename(m_print_config.output_filename_format.value, ".sl1", filename_base, &config);
}
std::string SLAPrint::validate() const
std::string SLAPrint::validate(std::string*) const
{
for(SLAPrintObject * po : m_objects) {

View file

@ -458,7 +458,7 @@ public:
const SLAPrintStatistics& print_statistics() const { return m_print_statistics; }
std::string validate() const override;
std::string validate(std::string* warning = nullptr) const override;
// An aggregation of SliceRecord-s from all the print objects for each
// occupied layer. Slice record levels dont have to match exactly.