mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-22 21:50:51 -05:00
Fix missing seam markers in the preview on overhanging outer walls (#16296)
* Fix missing seam markers in the preview on overhanging outer walls An outer wall that starts on an overhang is labelled "Overhang wall" in G-code, like the overhanging part of an inner wall, so the preview's seam detector never opened a candidate for it. The G-code generator now writes one comment, OUTER_OVERHANG_WALL, before such a wall. The detector reads it and treats that wall as an outer wall for seam detection only, so extrusion roles, legend and colours stay the same. Markers also appear in G-code opened from a file. * Share the outer wall check and drop the sloped seam test variant A loop that starts on an overhang never gets a scarf seam, so the tagged stream with a sloped start could not be generated. The outer wall check used by the G-code generator and SeamPlacer moves to is_outer_wall(), and the generator runs it last, after the cheap conditions.
This commit is contained in:
1 parent
4b21b29cd2
commit
97bf1f4d1d
8 files changed
+274
-14
No files matched your search
@@ -130,7 +130,8 @@ const std::vector<std::string> GCodeProcessor::Reserved_Tags = {
|
||||
"@TOTAL_WEIGHT@",
|
||||
"@TOTAL_COST@",
|
||||
"@TOTAL_WIPE_TOWER_COST@",
|
||||
"@TOTAL_WIPE_TOWER_FILAMENT@"
|
||||
"@TOTAL_WIPE_TOWER_FILAMENT@",
|
||||
" OUTER_OVERHANG_WALL"
|
||||
};
|
||||
|
||||
const std::vector<std::string> GCodeProcessor::Reserved_Tags_compatible = {
|
||||
@@ -163,7 +164,8 @@ const std::vector<std::string> GCodeProcessor::Reserved_Tags_compatible = {
|
||||
"@TOTAL_WEIGHT@",
|
||||
"@TOTAL_COST@",
|
||||
"@TOTAL_WIPE_TOWER_COST@",
|
||||
"@TOTAL_WIPE_TOWER_FILAMENT@"
|
||||
"@TOTAL_WIPE_TOWER_FILAMENT@",
|
||||
" OUTER_OVERHANG_WALL"
|
||||
};
|
||||
|
||||
|
||||
@@ -3814,6 +3816,9 @@ void GCodeProcessor::reset()
|
||||
m_layer_id = 0;
|
||||
m_cp_color.reset();
|
||||
m_mass_locator = nullptr;
|
||||
m_seams_detector.reset();
|
||||
m_outer_overhang_pending = false;
|
||||
m_outer_overhang_candidate = false;
|
||||
|
||||
m_producer = EProducer::Unknown;
|
||||
|
||||
@@ -4695,6 +4700,12 @@ void GCodeProcessor::process_tags(const std::string_view comment, bool producers
|
||||
return;
|
||||
}
|
||||
|
||||
// Orca: the next printing move starts an outer wall, whatever its role
|
||||
if (comment == reserved_tag(ETags::Outer_Overhang_Wall)) {
|
||||
m_outer_overhang_pending = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// layer change tag
|
||||
if (comment == reserved_tag(ETags::Layer_Change)) {
|
||||
++m_layer_id;
|
||||
@@ -5700,9 +5711,17 @@ void GCodeProcessor::process_G1(const std::array<std::optional<double>, 4>& axes
|
||||
|
||||
const Vec3f plate_offset = {(float) m_x_offset, (float) m_y_offset, 0.0f};
|
||||
|
||||
// Orca: a tagged wall that starts on an overhang is an outer wall for the seam detector only.
|
||||
if (type == EMoveType::Extrude && m_outer_overhang_pending) {
|
||||
m_outer_overhang_candidate = m_extrusion_role == erOverhangPerimeter;
|
||||
m_outer_overhang_pending = false;
|
||||
}
|
||||
const bool external_for_seam = m_extrusion_role == erExternalPerimeter ||
|
||||
(m_extrusion_role == erOverhangPerimeter && m_outer_overhang_candidate);
|
||||
|
||||
if (m_seams_detector.is_active()) {
|
||||
// check for seam starting vertex
|
||||
if (type == EMoveType::Extrude && m_extrusion_role == erExternalPerimeter) {
|
||||
if (type == EMoveType::Extrude && external_for_seam) {
|
||||
//BBS: m_result.moves.back().position has plate offset, must minus plate offset before calculate the real seam position
|
||||
const Vec3f new_pos = m_result.moves.back().position - m_extruder_offsets[filament_id] - plate_offset;
|
||||
if (!m_seams_detector.has_first_vertex()) {
|
||||
@@ -5734,9 +5753,10 @@ void GCodeProcessor::process_G1(const std::array<std::optional<double>, 4>& axes
|
||||
}
|
||||
|
||||
m_seams_detector.activate(false);
|
||||
m_outer_overhang_candidate = false;
|
||||
}
|
||||
}
|
||||
else if (type == EMoveType::Extrude && m_extrusion_role == erExternalPerimeter) {
|
||||
else if (type == EMoveType::Extrude && external_for_seam) {
|
||||
m_seams_detector.activate(true);
|
||||
m_seams_detector.set_first_vertex(m_result.moves.back().position - m_extruder_offsets[filament_id] - plate_offset);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user