GCode Preview - Fixed z values set on sliders

This commit is contained in:
Enrico Turri 2018-03-27 11:35:48 +02:00
parent 48fe019302
commit c166af5cce

View File

@ -643,14 +643,18 @@ void GLVolumeCollection::update_outside_state(const DynamicPrintConfig* config,
std::vector<double> GLVolumeCollection::get_current_print_zs() const std::vector<double> GLVolumeCollection::get_current_print_zs() const
{ {
std::vector<double> print_zs; std::vector<double> print_zs;
std::vector<double> rounded_print_zs;
for (GLVolume *vol : this->volumes) for (GLVolume *vol : this->volumes)
{ {
for (coordf_t z : vol->print_zs) for (coordf_t z : vol->print_zs)
{ {
double round_z = (double)round(z * 100000.0f) / 100000.0f; double round_z = ::round(z * 100000.0 + 0.5) / 100000.0;
if (std::find(print_zs.begin(), print_zs.end(), round_z) == print_zs.end()) if (std::find(rounded_print_zs.begin(), rounded_print_zs.end(), round_z) == rounded_print_zs.end())
print_zs.push_back(round_z); {
print_zs.push_back(z);
rounded_print_zs.push_back(round_z);
}
} }
} }