Revert "Feature boundary test lxy (#128)"

This reverts commit a1769a2148.
This commit is contained in:
xiaoyeliu
2026-01-24 10:43:54 +08:00
parent b1fb3e3289
commit b8bf1a8fe1
28 changed files with 23 additions and 6097 deletions
+2 -61
View File
@@ -8,9 +8,6 @@
#include "libslic3r.h"
#include "PrintConfig.hpp"
#include "Model.hpp"
#include "BoundaryValidator.hpp"
#include "BuildVolume.hpp"
#include "GCode/GCodeProcessor.hpp"
#include <algorithm>
#include <numeric>
#include <unordered_set>
@@ -990,7 +987,7 @@ static ExPolygons outer_inner_brim_area(const Print& print,
polygons_reverse(ex_poly_holes_reversed);
if (has_outer_brim) {
// Snapmaker: inner and outer boundary are offset from the same polygon incase of round off error.
// BBS: inner and outer boundary are offset from the same polygon incase of round off error.
auto innerExpoly = offset_ex(ex_poly.contour, brim_offset, jtRound, SCALED_RESOLUTION);
ExPolygons outerExpoly;
if (use_brim_ears) {
@@ -1693,8 +1690,7 @@ void make_brim(const Print& print, PrintTryCancel try_cancel, Polygons& islands_
std::map<ObjectID, ExtrusionEntityCollection>& brimMap,
std::map<ObjectID, ExtrusionEntityCollection>& supportBrimMap,
std::vector<std::pair<ObjectID, unsigned int>> &objPrintVec,
std::vector<unsigned int>& printExtruders,
Print* print_ptr)
std::vector<unsigned int>& printExtruders)
{
double brim_width_max = 0;
@@ -1742,68 +1738,13 @@ void make_brim(const Print& print, PrintTryCancel try_cancel, Polygons& islands_
for (size_t iia = 0; iia < islands_area.size(); ++iia)
islands_area[iia].translate(plate_shift);
// Snapmaker: Create BuildVolume and BoundaryValidator for brim boundary checking
BuildVolume build_volume(print.config().printable_area.values, print.config().printable_height);
BuildVolumeBoundaryValidator validator(build_volume);
double first_layer_height = print.skirt_first_layer_height();
for (auto iter = brimAreaMap.begin(); iter != brimAreaMap.end(); ++iter) {
if (!iter->second.empty()) {
// Snapmaker: Validate brim area against build volume boundaries
for (const ExPolygon& expoly : iter->second) {
if (!validator.validate_polygon(expoly.contour, first_layer_height)) {
// Record boundary violation
if (print_ptr) {
BoundingBox bbox = get_extents(expoly.contour);
Vec3d violation_pos(
unscale<double>(bbox.center().x()),
unscale<double>(bbox.center().y()),
first_layer_height
);
PrintObject* obj = const_cast<PrintObject*>(print.get_object(iter->first));
std::string obj_name = obj ? obj->model_object()->name : "Unknown";
ConflictResult violation = ConflictResult::create_boundary_violation(
static_cast<int>(BoundaryValidator::ViolationType::Brim),
violation_pos,
first_layer_height,
obj_name
);
print_ptr->add_boundary_violation(violation);
BOOST_LOG_TRIVIAL(warning) << "Brim for object " << obj_name
<< " exceeds build volume boundaries at z=" << first_layer_height << " mm";
}
}
}
brimMap.insert(std::make_pair(iter->first, makeBrimInfill(iter->second, print, islands_area)));
};
}
for (auto iter = supportBrimAreaMap.begin(); iter != supportBrimAreaMap.end(); ++iter) {
if (!iter->second.empty()) {
// Snapmaker: Validate support brim area against build volume boundaries
for (const ExPolygon& expoly : iter->second) {
if (!validator.validate_polygon(expoly.contour, first_layer_height)) {
// Record boundary violation
if (print_ptr) {
BoundingBox bbox = get_extents(expoly.contour);
Vec3d violation_pos(
unscale<double>(bbox.center().x()),
unscale<double>(bbox.center().y()),
first_layer_height
);
PrintObject* obj = const_cast<PrintObject*>(print.get_object(iter->first));
std::string obj_name = obj ? obj->model_object()->name : "Unknown";
ConflictResult violation = ConflictResult::create_boundary_violation(
static_cast<int>(BoundaryValidator::ViolationType::Brim),
violation_pos,
first_layer_height,
obj_name + " (support brim)"
);
print_ptr->add_boundary_violation(violation);
BOOST_LOG_TRIVIAL(warning) << "Support brim for object " << obj_name
<< " exceeds build volume boundaries at z=" << first_layer_height << " mm";
}
}
}
supportBrimMap.insert(std::make_pair(iter->first, makeBrimInfill(iter->second, print, islands_area)));
};
}