mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-15 19:35:57 +08:00
fix 'print external perimeter first' also print thinwall first
supermerill/SuperSlicer#2168
This commit is contained in:
parent
1488051552
commit
f75093ec91
@ -960,25 +960,41 @@ void PerimeterGenerator::process()
|
|||||||
|
|
||||||
// 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
|
||||||
|
// be careful to not print thin walls before perimeters (gapfill will be added after so don't worry for them)
|
||||||
// TODO: add test for perimeter order
|
// TODO: add test for perimeter order
|
||||||
if (this->config->external_perimeters_first ||
|
const bool brim_first_layer = this->layer->id() == 0 && (this->object_config->brim_width.value > 0 || this->object_config->brim_width_interior.value > 0);
|
||||||
(this->layer->id() == 0 && this->object_config->brim_width.value > 0)) {
|
if (this->config->external_perimeters_first || brim_first_layer) {
|
||||||
if (this->config->external_perimeters_nothole.value ||
|
if (this->config->external_perimeters_nothole.value || brim_first_layer) {
|
||||||
(this->layer->id() == 0 && this->object_config->brim_width.value > 0)) {
|
if (this->config->external_perimeters_hole.value || brim_first_layer) {
|
||||||
if (this->config->external_perimeters_hole.value ||
|
//reverse only not-thin wall
|
||||||
(this->layer->id() == 0 && this->object_config->brim_width.value > 0)) {
|
|
||||||
entities.reverse();
|
|
||||||
} else {
|
|
||||||
//reverse only not-hole perimeters
|
|
||||||
ExtrusionEntityCollection coll2;
|
ExtrusionEntityCollection coll2;
|
||||||
for (const auto loop : entities.entities) {
|
for (const auto loop : entities.entities) {
|
||||||
if (loop->is_loop() && !(((ExtrusionLoop*)loop)->loop_role() & ExtrusionLoopRole::elrHole) != 0) {
|
if ( (loop->is_loop() && loop->role() != erThinWall)) {
|
||||||
coll2.entities.push_back(loop);
|
coll2.entities.push_back(loop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
coll2.reverse();
|
coll2.reverse();
|
||||||
for (const auto loop : entities.entities) {
|
for (const auto loop : entities.entities) {
|
||||||
if (!loop->is_loop() || (((ExtrusionLoop*)loop)->loop_role() & ExtrusionLoopRole::elrHole) != 0) {
|
if (!((loop->is_loop() && loop->role() != erThinWall))) {
|
||||||
|
coll2.entities.push_back(loop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//note: this hacky thing is possible because coll2.entities contains in fact entities's entities
|
||||||
|
//if you does entities = coll2, you'll delete entities's entities and then you have nothing.
|
||||||
|
entities.entities = coll2.entities;
|
||||||
|
//and you have to empty coll2 or it will delete his content, hence crashing our hack
|
||||||
|
coll2.entities.clear();
|
||||||
|
} else {
|
||||||
|
//reverse only not-hole perimeters
|
||||||
|
ExtrusionEntityCollection coll2;
|
||||||
|
for (const auto loop : entities.entities) {
|
||||||
|
if ((loop->is_loop() && loop->role() != erThinWall) && !(((ExtrusionLoop*)loop)->loop_role() & ExtrusionLoopRole::elrHole) != 0) {
|
||||||
|
coll2.entities.push_back(loop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
coll2.reverse();
|
||||||
|
for (const auto loop : entities.entities) {
|
||||||
|
if (!((loop->is_loop() && loop->role() != erThinWall) && (((ExtrusionLoop*)loop)->loop_role() & ExtrusionLoopRole::elrHole) != 0)) {
|
||||||
coll2.entities.push_back(loop);
|
coll2.entities.push_back(loop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -992,13 +1008,13 @@ void PerimeterGenerator::process()
|
|||||||
//reverse the hole, and put them in first place.
|
//reverse the hole, and put them in first place.
|
||||||
ExtrusionEntityCollection coll2;
|
ExtrusionEntityCollection coll2;
|
||||||
for (const auto loop : entities.entities) {
|
for (const auto loop : entities.entities) {
|
||||||
if (loop->is_loop() && (((ExtrusionLoop*)loop)->loop_role() & ExtrusionLoopRole::elrHole) != 0) {
|
if ((loop->is_loop() && loop->role() != erThinWall) && (((ExtrusionLoop*)loop)->loop_role() & ExtrusionLoopRole::elrHole) != 0) {
|
||||||
coll2.entities.push_back(loop);
|
coll2.entities.push_back(loop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
coll2.reverse();
|
coll2.reverse();
|
||||||
for (const auto loop : entities.entities) {
|
for (const auto loop : entities.entities) {
|
||||||
if (!loop->is_loop() || !(((ExtrusionLoop*)loop)->loop_role() & ExtrusionLoopRole::elrHole) != 0) {
|
if (!((loop->is_loop() && loop->role() != erThinWall) && (((ExtrusionLoop*)loop)->loop_role() & ExtrusionLoopRole::elrHole) != 0)) {
|
||||||
coll2.entities.push_back(loop);
|
coll2.entities.push_back(loop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user