From 6536e18423376ffd72818899d64f8280e68777d1 Mon Sep 17 00:00:00 2001 From: thysson2701 Date: Tue, 21 Jul 2026 21:38:55 +0200 Subject: [PATCH] fix(build): Polyline3/Line3 conversions in GCode.cpp wipe+gradient, add sparse_infill_filament config --- src/libslic3r/GCode.cpp | 28 ++++++++++++++++------------ src/libslic3r/PrintConfig.hpp | 1 + 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 7b65767db78..ce2006e5b2b 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -10446,7 +10446,7 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou // inside the model if(discoveredTouchingLines > 1){ // use extrude instead of travel_to_xy to trigger the unretract - ExtrusionPath fake_path_wipe(Polyline{pt, current_point}, paths.front()); + ExtrusionPath fake_path_wipe(Polyline3(Polyline{pt, current_point}), paths.front()); fake_path_wipe.set_force_no_extrusion(true); fake_path_wipe.mm3_per_mm = 0; //fake_path_wipe.set_extrusion_role(erExternalPerimeter); @@ -10540,10 +10540,11 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou for (ExtrusionPath &path : paths) { //BBS: Don't need to save duplicated point into wipe path if (!m_wipe.path.empty() && !path.empty() && - m_wipe.path.last_point() == path.first_point()) - m_wipe.path.append(path.polyline.points.begin() + 1, path.polyline.points.end()); - else - m_wipe.path.append(path.polyline); // TODO: don't limit wipe to last path + m_wipe.path.last_point() == path.first_point()) { + Polyline pl2d = path.polyline.to_polyline(); + m_wipe.path.append(pl2d.points.begin() + 1, pl2d.points.end()); + } else + m_wipe.path.append(path.polyline.to_polyline()); // TODO: don't limit wipe to last path } } @@ -10625,10 +10626,11 @@ std::string GCode::extrude_multi_path(ExtrusionMultiPath multipath, std::string for (ExtrusionPath &path : multipath.paths) { //BBS: Don't need to save duplicated point into wipe path if (!m_wipe.path.empty() && !path.empty() && - m_wipe.path.last_point() == path.first_point()) - m_wipe.path.append(path.polyline.points.begin() + 1, path.polyline.points.end()); - else - m_wipe.path.append(path.polyline); // TODO: don't limit wipe to last path + m_wipe.path.last_point() == path.first_point()) { + Polyline pl2d = path.polyline.to_polyline(); + m_wipe.path.append(pl2d.points.begin() + 1, pl2d.points.end()); + } else + m_wipe.path.append(path.polyline.to_polyline()); // TODO: don't limit wipe to last path } m_wipe.path.reverse(); } @@ -10657,7 +10659,7 @@ std::string GCode::extrude_path(ExtrusionPath path, std::string description, dou // description += ExtrusionEntity::role_to_string(path.role()); std::string gcode = this->_extrude(path, description, speed); if (m_wipe.enable && FILAMENT_CONFIG(wipe)) { - m_wipe.path = path.polyline; + m_wipe.path = path.polyline.to_polyline(); if (is_tree(this->config().support_type) && (path.role() == erSupportMaterial || path.role() == erSupportMaterialInterface || path.role() == erSupportTransition)) { if ((m_wipe.path.first_point() - m_wipe.path.last_point()).cast().norm() > scale_(0.2)) { double min_dist = scale_(0.2); @@ -12591,7 +12593,8 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, (outer_wall_gradient_dynamic_ctx.object_center_mode || outer_wall_gradient_dynamic_ctx.vertex_color_match_mode); size_t line_idx = 0; - for (const Line3 &line : path.polyline.lines()) { + for (const Line3 &line3 : path.polyline.lines()) { + const Line line(line3.a.to_point(), line3.b.to_point()); const size_t segment_idx = line_idx++; const double line_length = line.length() * SCALING_FACTOR; if (!std::isfinite(line_length) || line_length < EPSILON) @@ -13392,7 +13395,8 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, } } else { size_t line_idx = 0; - for (const Line& line : path.polyline.lines()) { + for (const Line3& line3 : path.polyline.lines()) { + const Line line(line3.a.to_point(), line3.b.to_point()); const size_t segment_idx = line_idx++; std::string tempDescription = description; const double line_length = line.length() * SCALING_FACTOR; diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 9859e8f3b41..96114557020 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -1125,6 +1125,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionInt, fuzzy_skin_layers_between_ripple_offset)) ((ConfigOptionFloat, gap_infill_speed)) ((ConfigOptionInt, sparse_infill_filament_id)) + ((ConfigOptionInt, sparse_infill_filament)) ((ConfigOptionFloatOrPercent, sparse_infill_line_width)) ((ConfigOptionPercent, infill_wall_overlap)) ((ConfigOptionPercent, top_bottom_infill_wall_overlap))