FIX: error layer height on gui while open scarf seam

Github: 4132

Thanks orca, this fix merged from orca

Signed-off-by: qing.zhang <qing.zhang@bambulab.com>
Change-Id: Ic2361299532b3cc4667e7744f23aedd4414d8a08
This commit is contained in:
qing.zhang 2024-06-03 17:35:41 +08:00 committed by Lane.Wei
parent 3bafdb7e3c
commit 1fa62efb66
1 changed files with 9 additions and 3 deletions

View File

@ -3191,11 +3191,17 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
}
if (m_detect_layer_based_on_tag && !m_result.spiral_vase_layers.empty()) {
if (m_result.spiral_vase_layers.back().first == FLT_MAX && delta_pos[Z] > 0.0)
if (delta_pos[Z] >= 0.0 && type == EMoveType::Extrude) {
const float current_z = static_cast<float>(m_end_position[Z]);
// replace layer height placeholder with correct value
m_result.spiral_vase_layers.back().first = static_cast<float>(m_end_position[Z]);
if (m_result.spiral_vase_layers.back().first == FLT_MAX) {
m_result.spiral_vase_layers.back().first = current_z;
} else {
m_result.spiral_vase_layers.back().first = std::max(m_result.spiral_vase_layers.back().first, current_z);
}
}
if (!m_result.moves.empty())
m_result.spiral_vase_layers.back().second.second = m_result.moves.size() - 1;
m_result.spiral_vase_layers.back().second.second = m_result.moves.size() - 1 - m_seams_count;
}
// store move