Fix of discrepancy between G-code placeholder parser current layer index
and total number of layers. Fixed for non-sequential print only for now. Partial fix of #9866
This commit is contained in:
parent
de09af23b7
commit
de3de3fd11
1 changed files with 1 additions and 12 deletions
|
@ -1005,18 +1005,6 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||||
std::sort(zs.begin(), zs.end());
|
std::sort(zs.begin(), zs.end());
|
||||||
m_layer_count += (unsigned int)(object->instances().size() * (std::unique(zs.begin(), zs.end()) - zs.begin()));
|
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;
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
std::sort(zs.begin(), zs.end());
|
|
||||||
m_layer_count = (unsigned int)(std::unique(zs.begin(), zs.end()) - zs.begin());
|
|
||||||
}
|
}
|
||||||
print.throw_if_canceled();
|
print.throw_if_canceled();
|
||||||
|
|
||||||
|
@ -1144,6 +1132,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||||
this->set_extruders(tool_ordering.all_extruders());
|
this->set_extruders(tool_ordering.all_extruders());
|
||||||
// Order object instances using a nearest neighbor search.
|
// Order object instances using a nearest neighbor search.
|
||||||
print_object_instances_ordering = chain_print_object_instances(print);
|
print_object_instances_ordering = chain_print_object_instances(print);
|
||||||
|
m_layer_count = tool_ordering.layer_tools().size();
|
||||||
}
|
}
|
||||||
if (initial_extruder_id == (unsigned int)-1) {
|
if (initial_extruder_id == (unsigned int)-1) {
|
||||||
// Nothing to print!
|
// Nothing to print!
|
||||||
|
|
Loading…
Add table
Reference in a new issue