forked from prusa3d/PrusaSlicer
-
-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change direction for perimeter extrusion at odd layers for overhangs.
- Loading branch information
supermerill
committed
Jul 12, 2018
1 parent
592588a
commit 87245ae
Showing
3 changed files
with
20 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,8 +158,8 @@ void PerimeterGenerator::process() | |
// We can add more perimeters if there are uncovered overhangs | ||
// improvement for future: find a way to add perimeters only where it's needed. | ||
// It's hard to do, so here is a simple version. | ||
bool may_add_more_perimeters = false; | ||
if (this->config->extra_perimeters && i > loop_number && !last.empty() | ||
bool has_overhang = false; | ||
if (this->config->extra_perimeters /*&& i > loop_number*/ && !last.empty() | ||
&& this->lower_slices != NULL && !this->lower_slices->expolygons.empty()){ | ||
//split the polygons with bottom/notbottom | ||
ExPolygons unsupported = diff_ex(last, this->lower_slices->expolygons, true); | ||
|
@@ -199,7 +199,7 @@ void PerimeterGenerator::process() | |
} | ||
if (!unsupported.empty()) { | ||
//add fake perimeters here | ||
may_add_more_perimeters = true; | ||
has_overhang = true; | ||
} | ||
} | ||
} | ||
|
@@ -279,7 +279,7 @@ void PerimeterGenerator::process() | |
last.clear(); | ||
break; | ||
} else if (i > loop_number) { | ||
if (may_add_more_perimeters) { | ||
if (has_overhang) { | ||
loop_number++; | ||
contours.emplace_back(); | ||
holes.emplace_back(); | ||
|
@@ -290,11 +290,11 @@ void PerimeterGenerator::process() | |
} | ||
|
||
for (const ExPolygon &expolygon : next_onion) { | ||
contours[i].emplace_back(PerimeterGeneratorLoop(expolygon.contour, i, true)); | ||
contours[i].emplace_back(PerimeterGeneratorLoop(expolygon.contour, i, true, has_overhang)); | ||
if (! expolygon.holes.empty()) { | ||
holes[i].reserve(holes[i].size() + expolygon.holes.size()); | ||
for (const Polygon &hole : expolygon.holes) | ||
holes[i].emplace_back(PerimeterGeneratorLoop(hole, i, false)); | ||
holes[i].emplace_back(PerimeterGeneratorLoop(hole, i, false, has_overhang)); | ||
} | ||
} | ||
last = std::move(next_onion); | ||
|
@@ -536,7 +536,10 @@ ExtrusionEntityCollection PerimeterGenerator::_traverse_loops( | |
|
||
ExtrusionEntityCollection children = this->_traverse_loops(loop.children, thin_walls); | ||
if (loop.is_contour) { | ||
eloop.make_counter_clockwise(); | ||
if (loop.is_overhang && this->layer_id % 2 == 1) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
supermerill
Owner
|
||
eloop.make_clockwise(); | ||
else | ||
eloop.make_counter_clockwise(); | ||
entities.append(children.entities); | ||
entities.append(eloop); | ||
} else { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@supermerill
Hi, actually using term "odd layer" is wrong from user point of view. Though in code expression
layer_id % 2 == 1
is used, layer numeration in GUI starts from 1, i.e. layer_id+1. Thus reversing happens on even layers, starting from layer 2.