Fix of d146a0237e51b15ba39bb5c2a45e9d208e50b4cf

(reworked infill generator to merge regions with the same properties).
This commit is contained in:
bubnikv 2019-09-09 16:44:29 +02:00
parent 48ecbe777f
commit 735f5146e9

View File

@ -198,11 +198,12 @@ std::vector<SurfaceFill> group_fills(const Layer &layer)
{ {
Polygons all_polygons; Polygons all_polygons;
for (SurfaceFill &fill : surface_fills) for (SurfaceFill &fill : surface_fills)
if (! fill.expolygons.empty() && (fill.expolygons.size() > 1 || ! all_polygons.empty())) { if (! fill.expolygons.empty()) {
Polygons polys = to_polygons(std::move(fill.expolygons)); Polygons polys = to_polygons(std::move(fill.expolygons));
// Make a union of polygons, use a safety offset, subtract the preceding polygons. if (fill.expolygons.size() > 1 || ! all_polygons.empty())
// Bridges are processed first (see SurfaceFill::operator<()) // Make a union of polygons, use a safety offset, subtract the preceding polygons.
fill.expolygons = all_polygons.empty() ? union_ex(polys, true) : diff_ex(polys, all_polygons, true); // Bridges are processed first (see SurfaceFill::operator<())
fill.expolygons = all_polygons.empty() ? union_ex(polys, true) : diff_ex(polys, all_polygons, true);
append(all_polygons, std::move(polys)); append(all_polygons, std::move(polys));
} }
} }
@ -309,7 +310,6 @@ void Layer::make_fills()
f->layer_id = this->id(); f->layer_id = this->id();
f->z = this->print_z; f->z = this->print_z;
f->angle = surface_fill.params.angle; f->angle = surface_fill.params.angle;
f->spacing = surface_fill.params.spacing;
// calculate flow spacing for infill pattern generation // calculate flow spacing for infill pattern generation
bool using_internal_flow = ! surface_fill.surface.is_solid() && ! surface_fill.params.flow.bridge; bool using_internal_flow = ! surface_fill.surface.is_solid() && ! surface_fill.params.flow.bridge;
@ -335,8 +335,10 @@ void Layer::make_fills()
params.dont_adjust = surface_fill.params.dont_adjust; // false params.dont_adjust = surface_fill.params.dont_adjust; // false
for (ExPolygon &expoly : surface_fill.expolygons) { for (ExPolygon &expoly : surface_fill.expolygons) {
surface_fill.surface.expolygon = std::move(expoly); // Spacing is modified by the filler to indicate adjustments. Reset it for each expolygon.
Polylines polylines = f->fill_surface(&surface_fill.surface, params); f->spacing = surface_fill.params.spacing;
surface_fill.surface.expolygon = std::move(expoly);
Polylines polylines = f->fill_surface(&surface_fill.surface, params);
if (! polylines.empty()) { if (! polylines.empty()) {
// calculate actual flow from spacing (which might have been adjusted by the infill // calculate actual flow from spacing (which might have been adjusted by the infill
// pattern generator) // pattern generator)