FIX: crash while use conditional scarf

and clip paths correctly while has 50% overhang on slope

Jira: 6640 6639

Signed-off-by: qing.zhang <qing.zhang@bambulab.com>
Change-Id: I8abe43177c3965130514017eaaa75bc79ab7b2db
This commit is contained in:
qing.zhang 2024-03-22 10:35:47 +08:00 committed by Lane.Wei
parent 179191eefe
commit af8e195532
2 changed files with 6 additions and 5 deletions

View File

@ -322,7 +322,7 @@ void ExtrusionLoopSloped::clip_end(const double distance)
{
double clip_dist = distance;
std::vector<ExtrusionPathSloped> &ends_slope = this->ends;
while (clip_dist > 0) {
while (clip_dist > 0 && !ends_slope.empty()) {
ExtrusionPathSloped &last_path = ends_slope.back();
double len = last_path.length();
if (len <= clip_dist) {
@ -345,7 +345,7 @@ void ExtrusionLoopSloped::clip_front(const double distance)
std::vector<ExtrusionPathSloped> &start_slope = this->starts;
Polyline front_inward;
while (distance > 0) {
while (distance > 0 && !start_slope.empty()) {
ExtrusionPathSloped &first_path = start_slope.front();
double len = first_path.length();
if (len <= clip_dist) {

View File

@ -4081,13 +4081,14 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
paths.insert(paths.end(), new_loop.paths.begin(), new_loop.paths.end());
paths.insert(paths.end(), new_loop.ends.begin(), new_loop.ends.end());
}
} else {
paths.clear();
loop.clip_end(clip_length, &paths);
if (paths.empty()) return "";
}
}
if (!enable_seam_slope || slope_has_overhang) {
if (enable_seam_slope)
paths.back().clip_end(seam_gap);
for (ExtrusionPaths::iterator path = paths.begin(); path != paths.end(); ++path) {
gcode += this->_extrude(*path, description, speed_for_path(*path));
}