Avoid unnecessary travel in scarf seam (#9197)

* Avoid unnecessary travel in scarf seam (SoftFever/OrcaSlicer#9139)

* Fix typo
This commit is contained in:
Noisyfox 2025-04-13 17:37:40 +08:00 committed by GitHub
parent 0a3cbabae6
commit 2f8fa3fec2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5185,10 +5185,15 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
return lerp(m_nominal_z - height, m_nominal_z, z_ratio); return lerp(m_nominal_z - height, m_nominal_z, z_ratio);
}; };
bool slope_need_z_travel = false;
if (sloped != nullptr && !sloped->is_flat()) {
auto target_z = get_sloped_z(sloped->slope_begin.z_ratio);
slope_need_z_travel = m_writer.will_move_z(target_z);
}
// go to first point of extrusion path // go to first point of extrusion path
//BBS: path.first_point is 2D point. But in lazy raise case, lift z is done in travel_to function. //BBS: path.first_point is 2D point. But in lazy raise case, lift z is done in travel_to function.
//Add m_need_change_layer_lift_z when change_layer in case of no lift if m_last_pos is equal to path.first_point() by chance //Add m_need_change_layer_lift_z when change_layer in case of no lift if m_last_pos is equal to path.first_point() by chance
if (!m_last_pos_defined || m_last_pos != path.first_point() || m_need_change_layer_lift_z || (sloped != nullptr && !sloped->is_flat())) { if (!m_last_pos_defined || m_last_pos != path.first_point() || m_need_change_layer_lift_z || slope_need_z_travel) {
gcode += this->travel_to( gcode += this->travel_to(
path.first_point(), path.first_point(),
path.role(), path.role(),