Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsupermerill <merill@free.fr>2022-04-11 17:10:10 +0300
committersupermerill <merill@free.fr>2022-04-15 12:55:14 +0300
commitac588295805c782d242e98e1e750c713fe70bdb5 (patch)
treeab24d9e64197aaf6b2164d9b33cd240111377837 /src/libslic3r
parent9b697f53074f73a159198eb8eb2c31c3dcda15ec (diff)
Fix gcode processor initialization, can cause the gcode preview to be empty when there is no G1 in the custom start gcode.
supermerill/SuperSlicer#2711
Diffstat (limited to 'src/libslic3r')
-rw-r--r--src/libslic3r/GCode/GCodeProcessor.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp
index e97901dd0..3c9d2c844 100644
--- a/src/libslic3r/GCode/GCodeProcessor.cpp
+++ b/src/libslic3r/GCode/GCodeProcessor.cpp
@@ -1301,6 +1301,9 @@ void GCodeProcessor::reset()
m_result.reset();
m_result.id = ++s_result_id;
+ // 1st move must be a dummy move
+ assert(m_result.moves.empty());
+ m_result.moves.emplace_back();
m_use_volumetric_e = false;
m_last_default_color_id = 0;
@@ -1389,9 +1392,8 @@ void GCodeProcessor::process_file(const std::string& filename, std::function<voi
// process gcode
m_result.filename = filename;
m_result.id = ++s_result_id;
- // 1st move must be a dummy move
- assert(m_result.moves.empty());
- m_result.moves.emplace_back();
+ // 1st move must be a dummy move (should be added by the reset())
+ assert(m_result.moves.size() == 1 && m_result.moves.front().type == EMoveType::Noop);
size_t parse_line_callback_cntr = 10000;
m_parser.parse_file(filename, [this, cancel_callback, &parse_line_callback_cntr](GCodeReader& reader, const GCodeReader::GCodeLine& line) {
if (-- parse_line_callback_cntr == 0) {
@@ -1418,9 +1420,8 @@ void GCodeProcessor::initialize(const std::string& filename)
// process gcode
m_result.filename = filename;
m_result.id = ++s_result_id;
- // 1st move must be a dummy move
- assert(m_result.moves.empty());
- m_result.moves.emplace_back();
+ // 1st move must be a dummy move (should be added by the reset())
+ assert(m_result.moves.size()==1 && m_result.moves.front().type == EMoveType::Noop);
}
void GCodeProcessor::process_buffer(const std::string &buffer)