Scarf joint seam enhancement: conditional scarf joint and slowdown for scarf joint only (#4317)

* Allow apply scarf joint seams to perimeters without sharp corners only

* 1. Fix an error when detect whether a loop is smooth
2. Expose scarf_angle_threshold to UI

* fix linux build error

* minor code changes

* Support slowdown speed for scarf joint only

* update tips

* improve the logic a bit

* Fixed a bug that scarf speed may not respected for overhangs

* Add a new scarf flow ratio option
This commit is contained in:
SoftFever 2024-03-08 23:41:59 +08:00 committed by GitHub
parent 6264fe64b4
commit a4bf3dabb4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 144 additions and 4 deletions

View file

@ -4557,11 +4557,14 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
loop.split_at(last_pos, false);
const auto seam_scarf_type = m_config.seam_slope_type.value;
const bool enable_seam_slope = ((seam_scarf_type == SeamScarfType::External && !is_hole) || seam_scarf_type == SeamScarfType::All) &&
bool enable_seam_slope = ((seam_scarf_type == SeamScarfType::External && !is_hole) || seam_scarf_type == SeamScarfType::All) &&
!m_config.spiral_mode &&
(loop.role() == erExternalPerimeter || (loop.role() == erPerimeter && m_config.seam_slope_inner_walls)) &&
layer_id() > 0;
if (enable_seam_slope && m_config.seam_slope_conditional.value) {
enable_seam_slope = loop.is_smooth(m_config.scarf_angle_threshold.value * M_PI / 180., EXTRUDER_CONFIG(nozzle_diameter));
}
// clip the path to avoid the extruder to get exactly on the first point of the loop;
// if polyline was shorter than the clipping distance we'd get a null polyline, so
// we discard it in that case
@ -5068,6 +5071,8 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
_mm3_per_mm *= m_config.bottom_solid_infill_flow_ratio;
else if (path.role() == erInternalBridgeInfill)
_mm3_per_mm *= m_config.internal_bridge_flow;
else if(sloped)
_mm3_per_mm *= m_config.scarf_joint_flow_ratio;
double e_per_mm = m_writer.extruder()->e_per_mm3() * _mm3_per_mm;
@ -5082,6 +5087,10 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
double new_speed = m_config.get_abs_value(overhang_speed_key_map[overhang_degree].c_str());
speed = new_speed == 0.0 ? speed : new_speed;
}
if (sloped) {
speed = std::min(speed, m_config.scarf_joint_speed.get_abs_value(m_config.get_abs_value("inner_wall_speed")));
}
} else if (path.role() == erExternalPerimeter) {
speed = m_config.get_abs_value("outer_wall_speed");
if (m_config.overhang_speed_classic.value && m_config.enable_overhang_speed.value &&
@ -5089,6 +5098,9 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
double new_speed = m_config.get_abs_value(overhang_speed_key_map[overhang_degree].c_str());
speed = new_speed == 0.0 ? speed : new_speed;
}
if (sloped) {
speed = std::min(speed, m_config.scarf_joint_speed.get_abs_value(m_config.get_abs_value("outer_wall_speed")));
}
}
else if(path.role() == erInternalBridgeInfill) {
speed = m_config.get_abs_value("internal_bridge_speed");
@ -5172,6 +5184,9 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
(is_bridge(path.role()) || is_perimeter(path.role()))) {
bool is_external = is_external_perimeter(path.role());
double ref_speed = is_external ? m_config.get_abs_value("outer_wall_speed") : m_config.get_abs_value("inner_wall_speed");
if (sloped) {
ref_speed = std::min(ref_speed, m_config.scarf_joint_speed.get_abs_value(ref_speed));
}
ConfigOptionPercents overhang_overlap_levels({75, 50, 25, 13, 12.99, 0});
if (m_config.slowdown_for_curled_perimeters){
@ -5235,6 +5250,10 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
}
double F = speed * 60; // convert mm/sec to mm/min
if(abs(F - 5753.504) < 0.002)
{
std::cout << "F: " << F << std::endl;
}
//Orca: process custom gcode for extrusion role change
if (path.role() != m_last_extrusion_role && !m_config.change_extrusion_role_gcode.value.empty()) {