mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 15:37:30 -06:00
ENH: total layer number is wrong when enable support
This is fix for jira 2061 Layer height is double and may has small difference, which influence total layer number when support is enabled. Should use int data and consider EPSION when calculate total layer number. Signed-off-by: salt.wei <salt.wei@bambulab.com> Change-Id: I1bb6c89f2afd162d2d7e7dcff4a9d6a00b94dab3
This commit is contained in:
parent
b7b9029548
commit
9828101fa8
1 changed files with 9 additions and 6 deletions
|
@ -1290,23 +1290,26 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||
if (print.config().print_sequence == PrintSequence::ByObject) {
|
||||
// Add each of the object's layers separately.
|
||||
for (auto object : print.objects()) {
|
||||
std::vector<coordf_t> zs;
|
||||
//BBS: fix the issue that total layer is not right
|
||||
std::vector<coord_t> zs;
|
||||
zs.reserve(object->layers().size() + object->support_layers().size());
|
||||
for (auto layer : object->layers())
|
||||
zs.push_back(layer->print_z);
|
||||
zs.push_back((coord_t)(layer->print_z / EPSILON));
|
||||
for (auto layer : object->support_layers())
|
||||
zs.push_back(layer->print_z);
|
||||
zs.push_back((coord_t)(layer->print_z / EPSILON));
|
||||
std::sort(zs.begin(), zs.end());
|
||||
m_layer_count += (unsigned int)(object->instances().size() * (std::unique(zs.begin(), zs.end()) - zs.begin()));
|
||||
}
|
||||
} else {
|
||||
// Print all objects with the same print_z together.
|
||||
std::vector<coordf_t> zs;
|
||||
//BBS: fix the issue that total layer is not right
|
||||
std::vector<coord_t> zs;
|
||||
for (auto object : print.objects()) {
|
||||
zs.reserve(zs.size() + object->layers().size() + object->support_layers().size());
|
||||
for (auto layer : object->layers())
|
||||
zs.push_back(layer->print_z);
|
||||
for (auto layer : object->support_layers()) zs.push_back(layer->print_z);
|
||||
zs.push_back((coord_t)(layer->print_z / EPSILON));
|
||||
for (auto layer : object->support_layers())
|
||||
zs.push_back((coord_t)(layer->print_z / EPSILON));
|
||||
}
|
||||
std::sort(zs.begin(), zs.end());
|
||||
m_layer_count = (unsigned int)(std::unique(zs.begin(), zs.end()) - zs.begin());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue