Enhancement "Only one wall on top surfaces": better support for interface_shells (#8627)

one wall on top enhancement: better support for interface_shells
This commit is contained in:
SoftFever 2025-03-01 22:21:59 +08:00 committed by GitHub
parent 0965b92895
commit 93cb0426fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 3 deletions

View file

@ -107,7 +107,11 @@ void LayerRegion::make_perimeters(const SurfaceCollection &slices, const LayerRe
g.lower_slices = &this->layer()->lower_layer->lslices; g.lower_slices = &this->layer()->lower_layer->lslices;
if (this->layer()->upper_layer != NULL) if (this->layer()->upper_layer != NULL)
g.upper_slices = &this->layer()->upper_layer->lslices; g.upper_slices = &this->layer()->upper_layer->lslices;
int region_id = this->region().print_object_region_id();
if (this->layer()->upper_layer != NULL)
g.upper_slices_same_region = &this->layer()->upper_layer->get_region(region_id)->slices;
g.layer_id = (int)this->layer()->id(); g.layer_id = (int)this->layer()->id();
g.ext_perimeter_flow = this->flow(frExternalPerimeter); g.ext_perimeter_flow = this->flow(frExternalPerimeter);
g.overhang_flow = this->bridging_flow(frPerimeter, object_config.thick_bridges); g.overhang_flow = this->bridging_flow(frPerimeter, object_config.thick_bridges);

View file

@ -1368,7 +1368,13 @@ void PerimeterGenerator::split_top_surfaces(const ExPolygons &orig_polygons, ExP
double min_width_top_surface = std::max(double(ext_perimeter_spacing / 2. + 10), scale_(config->min_width_top_surface.get_abs_value(unscale_(perimeter_width)))); double min_width_top_surface = std::max(double(ext_perimeter_spacing / 2. + 10), scale_(config->min_width_top_surface.get_abs_value(unscale_(perimeter_width))));
// get the Polygons upper the polygon this layer // get the Polygons upper the polygon this layer
Polygons upper_polygons_series_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*this->upper_slices, last_box); Polygons upper_polygons_series_clipped;
if (object_config->interface_shells) {
auto upper_slicer_same_region = to_expolygons(this->upper_slices_same_region->surfaces);
upper_polygons_series_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(upper_slicer_same_region, last_box);
} else
upper_polygons_series_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*this->upper_slices, last_box);
upper_polygons_series_clipped = offset(upper_polygons_series_clipped, min_width_top_surface); upper_polygons_series_clipped = offset(upper_polygons_series_clipped, min_width_top_surface);
// set the clip to a virtual "second perimeter" // set the clip to a virtual "second perimeter"
@ -2991,7 +2997,13 @@ void PerimeterGenerator::process_arachne()
coord_t perimeter_width = this->perimeter_flow.scaled_width(); coord_t perimeter_width = this->perimeter_flow.scaled_width();
// Get top ExPolygons from current infill contour. // Get top ExPolygons from current infill contour.
Polygons upper_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*upper_slices, infill_contour_bbox); Polygons upper_slices_clipped;
if (object_config->interface_shells) {
auto upper_slicer_same_region = to_expolygons(this->upper_slices_same_region->surfaces);
upper_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(upper_slicer_same_region, infill_contour_bbox);
} else
upper_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*upper_slices, infill_contour_bbox);
top_expolygons = diff_ex(infill_contour, upper_slices_clipped); top_expolygons = diff_ex(infill_contour, upper_slices_clipped);
if (!top_expolygons.empty()) { if (!top_expolygons.empty()) {

View file

@ -63,6 +63,7 @@ public:
const SurfaceCollection *slices; const SurfaceCollection *slices;
const LayerRegionPtrs *compatible_regions; const LayerRegionPtrs *compatible_regions;
const ExPolygons *upper_slices; const ExPolygons *upper_slices;
const SurfaceCollection *upper_slices_same_region;
const ExPolygons *lower_slices; const ExPolygons *lower_slices;
double layer_height; double layer_height;
int layer_id; int layer_id;