Validate excluded bed area (#17209)

This commit is contained in:
Kiss Lorand authored and GitHub committed 2026-11-06 22:39:38 -03:00
1 parent bac7112046
commit c01ac8ff44
5 files changed
+80 -4

No files matched your search

+11
View File
@@ -8978,6 +8978,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
bool dlg_cont = true;
bool is_user_cancel = false;
bool translate_old = false;
bool invalid_bed_exclude_area = false;
int current_width = 0, current_depth = 0;
double current_height = 0;
@@ -9679,6 +9680,12 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
config.apply(static_cast<const ConfigBase &>(FullPrintConfig::defaults()));
// and place the loaded config over the base.
config += std::move(config_loaded);
if (ConfigOptionPoints *bed_exclude_area = config.option<ConfigOptionPoints>("bed_exclude_area");
bed_exclude_area != nullptr && bed_exclude_area->values.size() > 1 &&
!is_valid_bed_exclude_area(bed_exclude_area->values)) {
bed_exclude_area->values.clear();
invalid_bed_exclude_area = true;
}
std::map<std::string, std::string> validity = config.validate();
if (!validity.empty()) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" << __LINE__ << " " << boost::format("Param values in 3mf error: ");
@@ -10568,6 +10575,10 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
}
q->schedule_background_process(true);
q->mark_plate_toolbar_image_dirty();
if (invalid_bed_exclude_area) {
GUI::show_error(q, _L("The excluded bed area is invalid. It must be a simple, non-self-intersecting polygon.") +
"\n" + _L("The invalid area has been removed, so please define it again using a valid polygon."));
}
return obj_idxs;
}