Avoid cross perimeter improvements ported from BBS (#10220)

* FIX: fix avoid crossing perimeters not work[github issue #6597]

jira: STUDIO-11682

github: #6597

Change-Id: Ib86fac93280504e0040f1cce44dad4d02f709c01
(cherry picked from commit 35afceb9a7f4e5a3baba97f054d0e6768e4f59cf)

* FIX: optimize avoid crossing wall

jira: STUDIO-11682

Change-Id: I49b6756a5d3aeb482c019813074d8f6f9cc3c6ef
(cherry picked from commit e9b7006db994d78b9153dedfd0f89447c941cb76)

* Sync with latest BBS code

---------

Co-authored-by: huicong.li <huicong.li@bambulab.com>
This commit is contained in:
Noisyfox
2025-07-30 21:42:39 +08:00
committed by GitHub
parent c86eb27675
commit 282cdd111a
3 changed files with 195 additions and 108 deletions

View File

@@ -6085,10 +6085,11 @@ std::string GCode::travel_to(const Point& point, ExtrusionRole role, std::string
// if a retraction would be needed, try to use reduce_crossing_wall to plan a
// multi-hop travel path inside the configuration space
if ( m_config.reduce_crossing_wall
&& ! m_avoid_crossing_perimeters.disabled_once()
//BBS: don't generate detour travel paths when current position is unclear
&& m_writer.is_current_position_clear()) {
if (m_config.reduce_crossing_wall
&& !m_avoid_crossing_perimeters.disabled_once()
&& m_writer.is_current_position_clear())
//BBS: don't generate detour travel paths when current position is unclea
{
travel = m_avoid_crossing_perimeters.travel_to(*this, point, &could_be_wipe_disabled);
// check again whether the new travel path still needs a retraction
needs_retraction = this->needs_retraction(travel, role, lift_type);
@@ -6119,9 +6120,18 @@ std::string GCode::travel_to(const Point& point, ExtrusionRole role, std::string
if (used_external_mp_once)
m_avoid_crossing_perimeters.reset_once_modifiers();
}
} else
} else {
// Reset the wipe path when traveling, so one would not wipe along an old path.
m_wipe.reset_path();
// if (m_config.reduce_crossing_wall) {
// // If in the previous call of m_avoid_crossing_perimeters.travel_to was use_external_mp_once set to true restore this value for next call.
// if (used_external_mp_once) m_avoid_crossing_perimeters.use_external_mp_once();
// travel = m_avoid_crossing_perimeters.travel_to(*this, point);
// // If state of use_external_mp_once was changed reset it to right value.
// if (used_external_mp_once) m_avoid_crossing_perimeters.reset_once_modifiers();
// }
}
// if needed, write the gcode_label_objects_end then gcode_label_objects_start
m_writer.add_object_change_labels(gcode);