mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-20 21:27:52 -06:00
special outer wall order
This commit is contained in:
parent
88c0fea06f
commit
ff2cf17a73
1 changed files with 25 additions and 18 deletions
|
@ -612,18 +612,13 @@ void PerimeterGenerator::process()
|
||||||
}
|
}
|
||||||
|
|
||||||
// nest loops: holes first
|
// nest loops: holes first
|
||||||
int idx;
|
for (int d = 0; d <= loop_number; ++ d) {
|
||||||
for (int d = -1; d < loop_number; ++ d) {
|
PerimeterGeneratorLoops &holes_d = holes[d];
|
||||||
idx = d;
|
|
||||||
if (idx == -1)
|
|
||||||
idx = loop_number;
|
|
||||||
|
|
||||||
PerimeterGeneratorLoops &holes_d = holes[idx];
|
|
||||||
// loop through all holes having depth == d
|
// loop through all holes having depth == d
|
||||||
for (int i = 0; i < (int)holes_d.size(); ++ i) {
|
for (int i = 0; i < (int)holes_d.size(); ++ i) {
|
||||||
const PerimeterGeneratorLoop &loop = holes_d[i];
|
const PerimeterGeneratorLoop &loop = holes_d[i];
|
||||||
// find the hole loop that contains this one, if any
|
// find the hole loop that contains this one, if any
|
||||||
for (int t = idx + 1; t <= loop_number; ++ t) {
|
for (int t = d + 1; t <= loop_number; ++ t) {
|
||||||
for (int j = 0; j < (int)holes[t].size(); ++ j) {
|
for (int j = 0; j < (int)holes[t].size(); ++ j) {
|
||||||
PerimeterGeneratorLoop &candidate_parent = holes[t][j];
|
PerimeterGeneratorLoop &candidate_parent = holes[t][j];
|
||||||
if (candidate_parent.polygon.contains(loop.polygon.first_point())) {
|
if (candidate_parent.polygon.contains(loop.polygon.first_point())) {
|
||||||
|
@ -650,16 +645,13 @@ void PerimeterGenerator::process()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// nest contour loops
|
// nest contour loops
|
||||||
for (int d = loop_number-1; d >= 0; -- d) {
|
for (int d = loop_number; d >= 1; -- d) {
|
||||||
idx = d;
|
PerimeterGeneratorLoops &contours_d = contours[d];
|
||||||
if (idx == 0)
|
|
||||||
idx = loop_number;
|
|
||||||
PerimeterGeneratorLoops &contours_d = contours[idx];
|
|
||||||
// loop through all contours having depth == d
|
// loop through all contours having depth == d
|
||||||
for (int i = 0; i < (int)contours_d.size(); ++ i) {
|
for (int i = 0; i < (int)contours_d.size(); ++ i) {
|
||||||
const PerimeterGeneratorLoop &loop = contours_d[i];
|
const PerimeterGeneratorLoop &loop = contours_d[i];
|
||||||
// find the contour loop that contains it
|
// find the contour loop that contains it
|
||||||
for (int t = idx - 1; t >= 0; -- t) {
|
for (int t = d - 1; t >= 0; -- t) {
|
||||||
for (size_t j = 0; j < contours[t].size(); ++ j) {
|
for (size_t j = 0; j < contours[t].size(); ++ j) {
|
||||||
PerimeterGeneratorLoop &candidate_parent = contours[t][j];
|
PerimeterGeneratorLoop &candidate_parent = contours[t][j];
|
||||||
if (candidate_parent.polygon.contains(loop.polygon.first_point())) {
|
if (candidate_parent.polygon.contains(loop.polygon.first_point())) {
|
||||||
|
@ -675,6 +667,7 @@ void PerimeterGenerator::process()
|
||||||
}
|
}
|
||||||
// at this point, all loops should be in contours[0]
|
// at this point, all loops should be in contours[0]
|
||||||
ExtrusionEntityCollection entities = traverse_loops(*this, contours.front(), thin_walls);
|
ExtrusionEntityCollection entities = traverse_loops(*this, contours.front(), thin_walls);
|
||||||
|
|
||||||
// if brim will be printed, reverse the order of perimeters so that
|
// if brim will be printed, reverse the order of perimeters so that
|
||||||
// we continue inwards after having finished the brim
|
// we continue inwards after having finished the brim
|
||||||
// TODO: add test for perimeter order
|
// TODO: add test for perimeter order
|
||||||
|
@ -686,7 +679,21 @@ void PerimeterGenerator::process()
|
||||||
(this->layer_id == 0 &&
|
(this->layer_id == 0 &&
|
||||||
this->object_config->brim_type == BrimType::btOuterOnly &&
|
this->object_config->brim_type == BrimType::btOuterOnly &&
|
||||||
this->object_config->brim_width.value > 0))
|
this->object_config->brim_width.value > 0))
|
||||||
entities.reverse();
|
{
|
||||||
|
//entities.reverse();
|
||||||
|
if (entities.entities.size() > 1) {
|
||||||
|
std::vector<int> extPs;
|
||||||
|
for (int i = 0; i < entities.entities.size(); ++i) {
|
||||||
|
if (entities.entities[i]->role() == erExternalPerimeter)
|
||||||
|
extPs.push_back(i);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < extPs.size(); ++i) {
|
||||||
|
if (extPs[i] == 0 || extPs[i] - 1 == extPs[i - 1])
|
||||||
|
continue;
|
||||||
|
std::swap(entities.entities[extPs[i]], entities.entities[extPs[i] - 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// append perimeters for this slice as a collection
|
// append perimeters for this slice as a collection
|
||||||
if (! entities.empty())
|
if (! entities.empty())
|
||||||
this->loops->append(entities);
|
this->loops->append(entities);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue