ENH: fix empty infill layers
This is fix for github issue #216 that sometimes the infill layer is empty. Signed-off-by: salt.wei <salt.wei@bambulab.com> Change-Id: Ie3be08b75506e48f5ae9dd6aae2ae729ba666e01
This commit is contained in:
parent
1b07874ea3
commit
d4854c0df7
|
@ -190,7 +190,7 @@ void Layer::make_perimeters()
|
||||||
|
|
||||||
if (layerms.size() == 1) { // optimization
|
if (layerms.size() == 1) { // optimization
|
||||||
(*layerm)->fill_surfaces.surfaces.clear();
|
(*layerm)->fill_surfaces.surfaces.clear();
|
||||||
(*layerm)->make_perimeters((*layerm)->slices, &(*layerm)->fill_surfaces);
|
(*layerm)->make_perimeters((*layerm)->slices, &(*layerm)->fill_surfaces, &(*layerm)->fill_no_overlap_expolygons);
|
||||||
(*layerm)->fill_expolygons = to_expolygons((*layerm)->fill_surfaces.surfaces);
|
(*layerm)->fill_expolygons = to_expolygons((*layerm)->fill_surfaces.surfaces);
|
||||||
} else {
|
} else {
|
||||||
SurfaceCollection new_slices;
|
SurfaceCollection new_slices;
|
||||||
|
@ -212,7 +212,9 @@ void Layer::make_perimeters()
|
||||||
|
|
||||||
// make perimeters
|
// make perimeters
|
||||||
SurfaceCollection fill_surfaces;
|
SurfaceCollection fill_surfaces;
|
||||||
layerm_config->make_perimeters(new_slices, &fill_surfaces);
|
//BBS
|
||||||
|
ExPolygons fill_no_overlap;
|
||||||
|
layerm_config->make_perimeters(new_slices, &fill_surfaces, &fill_no_overlap);
|
||||||
|
|
||||||
// assign fill_surfaces to each layer
|
// assign fill_surfaces to each layer
|
||||||
if (!fill_surfaces.surfaces.empty()) {
|
if (!fill_surfaces.surfaces.empty()) {
|
||||||
|
@ -221,6 +223,8 @@ void Layer::make_perimeters()
|
||||||
ExPolygons expp = intersection_ex(fill_surfaces.surfaces, (*l)->slices.surfaces);
|
ExPolygons expp = intersection_ex(fill_surfaces.surfaces, (*l)->slices.surfaces);
|
||||||
(*l)->fill_expolygons = expp;
|
(*l)->fill_expolygons = expp;
|
||||||
(*l)->fill_surfaces.set(std::move(expp), fill_surfaces.surfaces.front());
|
(*l)->fill_surfaces.set(std::move(expp), fill_surfaces.surfaces.front());
|
||||||
|
//BBS: Separate fill_no_overlap
|
||||||
|
(*l)->fill_no_overlap_expolygons = intersection_ex((*l)->slices.surfaces, fill_no_overlap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,8 @@ public:
|
||||||
|
|
||||||
void slices_to_fill_surfaces_clipped();
|
void slices_to_fill_surfaces_clipped();
|
||||||
void prepare_fill_surfaces();
|
void prepare_fill_surfaces();
|
||||||
void make_perimeters(const SurfaceCollection &slices, SurfaceCollection* fill_surfaces);
|
//BBS
|
||||||
|
void make_perimeters(const SurfaceCollection &slices, SurfaceCollection* fill_surfaces, ExPolygons* fill_no_overlap);
|
||||||
void process_external_surfaces(const Layer *lower_layer, const Polygons *lower_layer_covered);
|
void process_external_surfaces(const Layer *lower_layer, const Polygons *lower_layer_covered);
|
||||||
double infill_area_threshold() const;
|
double infill_area_threshold() const;
|
||||||
// Trim surfaces by trimming polygons. Used by the elephant foot compensation at the 1st layer.
|
// Trim surfaces by trimming polygons. Used by the elephant foot compensation at the 1st layer.
|
||||||
|
|
|
@ -63,7 +63,7 @@ void LayerRegion::slices_to_fill_surfaces_clipped()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerRegion::make_perimeters(const SurfaceCollection &slices, SurfaceCollection* fill_surfaces)
|
void LayerRegion::make_perimeters(const SurfaceCollection &slices, SurfaceCollection* fill_surfaces, ExPolygons* fill_no_overlap)
|
||||||
{
|
{
|
||||||
this->perimeters.clear();
|
this->perimeters.clear();
|
||||||
this->thin_fills.clear();
|
this->thin_fills.clear();
|
||||||
|
@ -90,7 +90,9 @@ void LayerRegion::make_perimeters(const SurfaceCollection &slices, SurfaceCollec
|
||||||
// output:
|
// output:
|
||||||
&this->perimeters,
|
&this->perimeters,
|
||||||
&this->thin_fills,
|
&this->thin_fills,
|
||||||
fill_surfaces
|
fill_surfaces,
|
||||||
|
//BBS
|
||||||
|
fill_no_overlap
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this->layer()->lower_layer != nullptr)
|
if (this->layer()->lower_layer != nullptr)
|
||||||
|
@ -105,9 +107,6 @@ void LayerRegion::make_perimeters(const SurfaceCollection &slices, SurfaceCollec
|
||||||
g.solid_infill_flow = this->flow(frSolidInfill);
|
g.solid_infill_flow = this->flow(frSolidInfill);
|
||||||
|
|
||||||
g.process();
|
g.process();
|
||||||
|
|
||||||
// BBS
|
|
||||||
this->fill_no_overlap_expolygons = g.fill_no_overlap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//#define EXTERNAL_SURFACES_OFFSET_PARAMETERS ClipperLib::jtMiter, 3.
|
//#define EXTERNAL_SURFACES_OFFSET_PARAMETERS ClipperLib::jtMiter, 3.
|
||||||
|
|
|
@ -763,7 +763,7 @@ void PerimeterGenerator::process()
|
||||||
double(-inset - infill_peri_overlap));
|
double(-inset - infill_peri_overlap));
|
||||||
if (!top_fills.empty())
|
if (!top_fills.empty())
|
||||||
polyWithoutOverlap = union_ex(polyWithoutOverlap, top_infill_exp);
|
polyWithoutOverlap = union_ex(polyWithoutOverlap, top_infill_exp);
|
||||||
this->fill_no_overlap.insert(this->fill_no_overlap.end(), polyWithoutOverlap.begin(), polyWithoutOverlap.end());
|
this->fill_no_overlap->insert(this->fill_no_overlap->end(), polyWithoutOverlap.begin(), polyWithoutOverlap.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // for each island
|
} // for each island
|
||||||
|
|
|
@ -29,13 +29,14 @@ public:
|
||||||
ExtrusionEntityCollection *loops;
|
ExtrusionEntityCollection *loops;
|
||||||
ExtrusionEntityCollection *gap_fill;
|
ExtrusionEntityCollection *gap_fill;
|
||||||
SurfaceCollection *fill_surfaces;
|
SurfaceCollection *fill_surfaces;
|
||||||
|
//BBS
|
||||||
|
ExPolygons *fill_no_overlap;
|
||||||
|
|
||||||
//BBS
|
//BBS
|
||||||
Flow smaller_ext_perimeter_flow;
|
Flow smaller_ext_perimeter_flow;
|
||||||
std::map<int, Polygons> m_lower_polygons_series;
|
std::map<int, Polygons> m_lower_polygons_series;
|
||||||
std::map<int, Polygons> m_external_lower_polygons_series;
|
std::map<int, Polygons> m_external_lower_polygons_series;
|
||||||
std::map<int, Polygons> m_smaller_external_lower_polygons_series;
|
std::map<int, Polygons> m_smaller_external_lower_polygons_series;
|
||||||
ExPolygons fill_no_overlap;
|
|
||||||
|
|
||||||
PerimeterGenerator(
|
PerimeterGenerator(
|
||||||
// Input:
|
// Input:
|
||||||
|
@ -52,14 +53,16 @@ public:
|
||||||
// Gaps without the thin walls
|
// Gaps without the thin walls
|
||||||
ExtrusionEntityCollection* gap_fill,
|
ExtrusionEntityCollection* gap_fill,
|
||||||
// Infills without the gap fills
|
// Infills without the gap fills
|
||||||
SurfaceCollection* fill_surfaces)
|
SurfaceCollection* fill_surfaces,
|
||||||
|
//BBS
|
||||||
|
ExPolygons* fill_no_overlap)
|
||||||
: slices(slices), upper_slices(nullptr), lower_slices(nullptr), layer_height(layer_height),
|
: slices(slices), upper_slices(nullptr), lower_slices(nullptr), layer_height(layer_height),
|
||||||
layer_id(-1), perimeter_flow(flow), ext_perimeter_flow(flow),
|
layer_id(-1), perimeter_flow(flow), ext_perimeter_flow(flow),
|
||||||
overhang_flow(flow), solid_infill_flow(flow),
|
overhang_flow(flow), solid_infill_flow(flow),
|
||||||
config(config), object_config(object_config), print_config(print_config),
|
config(config), object_config(object_config), print_config(print_config),
|
||||||
m_spiral_vase(spiral_mode),
|
m_spiral_vase(spiral_mode),
|
||||||
m_scaled_resolution(scaled<double>(print_config->resolution.value > EPSILON ? print_config->resolution.value : EPSILON)),
|
m_scaled_resolution(scaled<double>(print_config->resolution.value > EPSILON ? print_config->resolution.value : EPSILON)),
|
||||||
loops(loops), gap_fill(gap_fill), fill_surfaces(fill_surfaces),
|
loops(loops), gap_fill(gap_fill), fill_surfaces(fill_surfaces), fill_no_overlap(fill_no_overlap),
|
||||||
m_ext_mm3_per_mm(-1), m_mm3_per_mm(-1), m_mm3_per_mm_overhang(-1), m_ext_mm3_per_mm_smaller_width(-1)
|
m_ext_mm3_per_mm(-1), m_mm3_per_mm(-1), m_mm3_per_mm_overhang(-1), m_ext_mm3_per_mm_smaller_width(-1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue