SPE-1673: Fixed travel toolpaths on top layer

This commit is contained in:
enricoturri1966 2023-05-17 12:56:55 +02:00
parent 04e92cb409
commit b4866c3cbf

View File

@ -2354,13 +2354,23 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
size_t last = path_id; size_t last = path_id;
// check adjacent paths // check adjacent paths
while (first > 0 && path.sub_paths.front().first.position.isApprox(buffer.paths[first - 1].sub_paths.back().last.position)) { while (first > 0) {
const Path& ref_path = buffer.paths[first - 1];
if (!path.sub_paths.front().first.position.isApprox(ref_path.sub_paths.back().last.position) ||
path.role != ref_path.role)
break;
path.sub_paths.front().first = ref_path.sub_paths.front().first;
--first; --first;
path.sub_paths.front().first = buffer.paths[first].sub_paths.front().first;
} }
while (last < buffer.paths.size() - 1 && path.sub_paths.back().last.position.isApprox(buffer.paths[last + 1].sub_paths.front().first.position)) { while (last < buffer.paths.size() - 1) {
const Path& ref_path = buffer.paths[last + 1];
if (!path.sub_paths.back().last.position.isApprox(ref_path.sub_paths.front().first.position) ||
path.role != ref_path.role)
break;
path.sub_paths.back().last = ref_path.sub_paths.back().last;
++last; ++last;
path.sub_paths.back().last = buffer.paths[last].sub_paths.back().last;
} }
const size_t min_s_id = m_layers.get_range_at(min_id).first; const size_t min_s_id = m_layers.get_range_at(min_id).first;