Fix bug where perimeters could be printed last because they start by a thin walls.

Now all thin walls are printed after their perimeters.
This commit is contained in:
supermerill 2020-06-18 03:54:55 +02:00
parent 186d7ce508
commit 6d5d0f82b8

View File

@ -954,11 +954,18 @@ ExtrusionEntityCollection PerimeterGenerator::_traverse_loops(
//little check: if you have external holes with only one extrusion and internal things, please draw the internal first, just in case it can help print the hole better. //little check: if you have external holes with only one extrusion and internal things, please draw the internal first, just in case it can help print the hole better.
std::vector<std::pair<size_t, bool>> better_chain; std::vector<std::pair<size_t, bool>> better_chain;
for (const std::pair<size_t, bool>& idx : chain) { for (const std::pair<size_t, bool>& idx : chain) {
if (idx.first >= loops.size() || !loops[idx.first].is_external() || (!loops[idx.first].is_contour && !loops[idx.first].children.empty())) if(idx.first < loops.size())
better_chain.push_back(idx); if (!loops[idx.first].is_external() || (!loops[idx.first].is_contour && !loops[idx.first].children.empty()))
better_chain.push_back(idx);
} }
for (const std::pair<size_t, bool>& idx : chain) { for (const std::pair<size_t, bool>& idx : chain) {
if (idx.first < loops.size() && loops[idx.first].is_external() && !(!loops[idx.first].is_contour && !loops[idx.first].children.empty())) if (idx.first < loops.size())
if (idx.first < loops.size() && loops[idx.first].is_external() && !(!loops[idx.first].is_contour && !loops[idx.first].children.empty()))
better_chain.push_back(idx);
}
//thin walls always last!
for (const std::pair<size_t, bool>& idx : chain) {
if (idx.first >= loops.size())
better_chain.push_back(idx); better_chain.push_back(idx);
} }