Elephant foot compensation improvements.

Fix of the negative XY compensation on multi-material (or multi-region)
prints, where the negative XY compensation created gaps between parts.
This commit is contained in:
bubnikv 2019-03-05 11:54:04 +01:00
parent c56004f946
commit 5e582efc5c
5 changed files with 139 additions and 27 deletions

View file

@ -65,6 +65,7 @@ void Layer::make_slices()
this->slices.expolygons.push_back(std::move(slices[i]));
}
// Merge typed slices into untyped slices. This method is used to revert the effects of detect_surfaces_type() called for posPrepareInfill.
void Layer::merge_slices()
{
if (m_regions.size() == 1) {
@ -78,6 +79,24 @@ void Layer::merge_slices()
}
}
ExPolygons Layer::merged(float offset_scaled) const
{
assert(offset_scaled >= 0.f);
// If no offset is set, apply EPSILON offset before union, and revert it afterwards.
float offset_scaled2 = 0;
if (offset_scaled == 0.f) {
offset_scaled = float( EPSILON);
offset_scaled2 = float(- EPSILON);
}
Polygons polygons;
for (LayerRegion *layerm : m_regions)
append(polygons, offset(to_expolygons(layerm->slices.surfaces), offset_scaled));
ExPolygons out = union_ex(polygons);
if (offset_scaled2 != 0.f)
out = offset_ex(out, offset_scaled2);
return out;
}
// Here the perimeters are created cummulatively for all layer regions sharing the same parameters influencing the perimeters.
// The perimeter paths and the thin fills (ExtrusionEntityCollection) are assigned to the first compatible layer region.
// The resulting fill surface is split back among the originating regions.