diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index d30ec70b5..65f0859ae 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -403,7 +403,13 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename) // remove trailing '\n' assert(! gcode_line.empty()); assert(gcode_line.back() == '\n'); - return gcode_line.substr(0, gcode_line.length() - 1) == ";" + Layer_Change_Tag; + + // return true for decorations which are used in processing the gcode but that should not be exported into the final gcode + // i.e.: + // bool ret = gcode_line.substr(0, gcode_line.length() - 1) == ";" + Layer_Change_Tag; + // ... + // return ret; + return false; }; // Iterators for the normal and silent cached time estimate entry recently processed, used by process_line_G1. @@ -1211,6 +1217,14 @@ bool GCodeProcessor::process_cura_tags(const std::string_view comment) return true; } + // layer + tag = "LAYER:"; + pos = comment.find(tag); + if (pos != comment.npos) { + ++m_layer_id; + return true; + } + return false; } @@ -1295,9 +1309,8 @@ bool GCodeProcessor::process_simplify3d_tags(const std::string_view comment) return true; } -#if ENABLE_GCODE_VIEWER_DATA_CHECKING // geometry - +#if ENABLE_GCODE_VIEWER_DATA_CHECKING // ; tool std::string tag = " tool"; pos = comment.find(tag); @@ -1322,6 +1335,19 @@ bool GCodeProcessor::process_simplify3d_tags(const std::string_view comment) } #endif // ENABLE_GCODE_VIEWER_DATA_CHECKING + // ; layer + std::string tag = " layer"; + pos = comment.find(tag); + if (pos == 0) { + // skip lines "; layer end" + const std::string_view data = comment.substr(pos + tag.length()); + size_t end_start = data.find("end"); + if (end_start == data.npos) + ++m_layer_id; + + return true; + } + return false; } @@ -1362,6 +1388,13 @@ bool GCodeProcessor::process_craftware_tags(const std::string_view comment) return true; } + // layer + pos = comment.find(" Layer #"); + if (pos == 0) { + ++m_layer_id; + return true; + } + return false; } @@ -1393,9 +1426,8 @@ bool GCodeProcessor::process_ideamaker_tags(const std::string_view comment) return true; } -#if ENABLE_GCODE_VIEWER_DATA_CHECKING // geometry - +#if ENABLE_GCODE_VIEWER_DATA_CHECKING // width tag = "WIDTH:"; pos = comment.find(tag); @@ -1415,6 +1447,13 @@ bool GCodeProcessor::process_ideamaker_tags(const std::string_view comment) } #endif // ENABLE_GCODE_VIEWER_DATA_CHECKING + // layer + pos = comment.find("LAYER:"); + if (pos == 0) { + ++m_layer_id; + return true; + } + return false; } diff --git a/src/slic3r/GUI/DoubleSlider.cpp b/src/slic3r/GUI/DoubleSlider.cpp index f4838e7b8..3fb47418d 100644 --- a/src/slic3r/GUI/DoubleSlider.cpp +++ b/src/slic3r/GUI/DoubleSlider.cpp @@ -629,7 +629,7 @@ wxString Control::get_label(int tick, LabelType label_type/* = ltHeightWithLayer return wxString::Format("%d", static_cast(m_values[value])); else { if (label_type == ltEstimatedTime) { - if (m_values.size() != m_layers_times.size()) + if (value > m_layers_times.size() - 1) return wxEmptyString; return short_and_splitted_time(get_time_dhms(m_layers_times[value])); }