mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-20 13:17:54 -06:00
Fix of re-slicing with multiple regions.
This is a fix of a bug, which was in Slic3r forever, where raw slices were not cached, but recalculated from classified regions, where merging the regions did not produce the original contour reliably. Fixes [2.3.0-beta2] Odd bad slicing related to infill (?) percentage #5407
This commit is contained in:
parent
cc7dbf8925
commit
a2959ec944
5 changed files with 38 additions and 20 deletions
|
@ -64,19 +64,30 @@ void Layer::make_slices()
|
|||
this->lslices.emplace_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()
|
||||
static inline bool layer_needs_raw_backup(const Layer *layer)
|
||||
{
|
||||
if (m_regions.size() == 1 && (this->id() > 0 || this->object()->config().elefant_foot_compensation.value == 0)) {
|
||||
// Optimization, also more robust. Don't merge classified pieces of layerm->slices,
|
||||
// but use the non-split islands of a layer. For a single region print, these shall be equal.
|
||||
// Don't use this optimization on 1st layer with Elephant foot compensation applied, as this->lslices are uncompensated,
|
||||
// while regions are compensated.
|
||||
m_regions.front()->slices.set(this->lslices, stInternal);
|
||||
} else {
|
||||
return ! (layer->regions().size() == 1 && (layer->id() > 0 || layer->object()->config().elefant_foot_compensation.value == 0));
|
||||
}
|
||||
|
||||
void Layer::backup_untyped_slices()
|
||||
{
|
||||
if (layer_needs_raw_backup(this)) {
|
||||
for (LayerRegion *layerm : m_regions)
|
||||
// without safety offset, artifacts are generated (upstream Slic3r GH #2494)
|
||||
layerm->slices.set(union_ex(to_polygons(std::move(layerm->slices.surfaces)), true), stInternal);
|
||||
layerm->raw_slices = to_expolygons(layerm->slices.surfaces);
|
||||
} else {
|
||||
assert(m_regions.size() == 1);
|
||||
m_regions.front()->raw_slices.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void Layer::restore_untyped_slices()
|
||||
{
|
||||
if (layer_needs_raw_backup(this)) {
|
||||
for (LayerRegion *layerm : m_regions)
|
||||
layerm->slices.set(layerm->raw_slices, stInternal);
|
||||
} else {
|
||||
assert(m_regions.size() == 1);
|
||||
m_regions.front()->slices.set(this->lslices, stInternal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue