1st installment of g-code window in preview

This commit is contained in:
enricoturri1966 2021-03-02 10:01:06 +01:00
parent 34417574f5
commit 2c8f385c7f
10 changed files with 251 additions and 4 deletions

View file

@ -747,8 +747,16 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessor::Result* re
BOOST_LOG_TRIVIAL(debug) << "Start processing gcode, " << log_memory_info();
m_processor.process_file(path_tmp, true, [print]() { print->throw_if_canceled(); });
DoExport::update_print_estimated_times_stats(m_processor, print->m_print_statistics);
#if ENABLE_GCODE_WINDOW
if (result != nullptr) {
*result = std::move(m_processor.extract_result());
// set the filename to the correct value
result->filename = path;
}
#else
if (result != nullptr)
*result = std::move(m_processor.extract_result());
#endif // ENABLE_GCODE_WINDOW
BOOST_LOG_TRIVIAL(debug) << "Finished processing gcode, " << log_memory_info();
if (rename_file(path_tmp, path))

View file

@ -6,6 +6,9 @@
#include <boost/log/trivial.hpp>
#include <boost/nowide/fstream.hpp>
#include <boost/nowide/cstdio.hpp>
#if ENABLE_GCODE_WINDOW
#include <boost/filesystem/path.hpp>
#endif // ENABLE_GCODE_WINDOW
#include <float.h>
#include <assert.h>
@ -976,6 +979,9 @@ void GCodeProcessor::process_file(const std::string& filename, bool apply_postpr
}
// process gcode
#if ENABLE_GCODE_WINDOW
m_result.filename = filename;
#endif // ENABLE_GCODE_WINDOW
m_result.id = ++s_result_id;
// 1st move must be a dummy move
m_result.moves.emplace_back(MoveVertex());

View file

@ -334,13 +334,15 @@ namespace Slic3r {
std::vector<std::string> filament;
std::string printer;
void reset()
{
void reset() {
print = "";
filament = std::vector<std::string>();
printer = "";
}
};
#if ENABLE_GCODE_WINDOW
std::string filename;
#endif // ENABLE_GCODE_WINDOW
unsigned int id;
std::vector<MoveVertex> moves;
Pointfs bed_shape;

View file

@ -99,6 +99,7 @@
#define ENABLE_WARNING_TEXTURE_REMOVAL (1 && ENABLE_2_3_1_ALPHA1)
#define ENABLE_GCODE_LINES_ID_IN_H_SLIDER (1 && ENABLE_2_3_1_ALPHA1)
#define ENABLE_VALIDATE_CUSTOM_GCODE (1 && ENABLE_2_3_1_ALPHA1)
#define ENABLE_GCODE_WINDOW (1 && ENABLE_2_3_1_ALPHA1)
#endif // _prusaslicer_technologies_h_