Refactoring to allow to quickly build the various options to show the estimated printing time in gcode viewer scene
This commit is contained in:
parent
510e787bc7
commit
8fc5be7e4f
15 changed files with 125 additions and 174 deletions
|
@ -779,8 +779,7 @@ void GCode::do_export(Print* print, const char* path, GCodePreviewData* preview_
|
||||||
m_processor.process_file(path_tmp);
|
m_processor.process_file(path_tmp);
|
||||||
if (result != nullptr)
|
if (result != nullptr)
|
||||||
*result = std::move(m_processor.extract_result());
|
*result = std::move(m_processor.extract_result());
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#else
|
||||||
|
|
||||||
GCodeTimeEstimator::PostProcessData normal_data = m_normal_time_estimator.get_post_process_data();
|
GCodeTimeEstimator::PostProcessData normal_data = m_normal_time_estimator.get_post_process_data();
|
||||||
GCodeTimeEstimator::PostProcessData silent_data = m_silent_time_estimator.get_post_process_data();
|
GCodeTimeEstimator::PostProcessData silent_data = m_silent_time_estimator.get_post_process_data();
|
||||||
|
|
||||||
|
@ -789,21 +788,19 @@ void GCode::do_export(Print* print, const char* path, GCodePreviewData* preview_
|
||||||
BOOST_LOG_TRIVIAL(debug) << "Time estimator post processing" << log_memory_info();
|
BOOST_LOG_TRIVIAL(debug) << "Time estimator post processing" << log_memory_info();
|
||||||
GCodeTimeEstimator::post_process(path_tmp, 60.0f, remaining_times_enabled ? &normal_data : nullptr, (remaining_times_enabled && m_silent_time_estimator_enabled) ? &silent_data : nullptr);
|
GCodeTimeEstimator::post_process(path_tmp, 60.0f, remaining_times_enabled ? &normal_data : nullptr, (remaining_times_enabled && m_silent_time_estimator_enabled) ? &silent_data : nullptr);
|
||||||
|
|
||||||
if (remaining_times_enabled)
|
if (remaining_times_enabled) {
|
||||||
{
|
|
||||||
m_normal_time_estimator.reset();
|
m_normal_time_estimator.reset();
|
||||||
if (m_silent_time_estimator_enabled)
|
if (m_silent_time_estimator_enabled)
|
||||||
m_silent_time_estimator.reset();
|
m_silent_time_estimator.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !ENABLE_GCODE_VIEWER
|
|
||||||
// starts analyzer calculations
|
// starts analyzer calculations
|
||||||
if (m_enable_analyzer) {
|
if (m_enable_analyzer) {
|
||||||
BOOST_LOG_TRIVIAL(debug) << "Preparing G-code preview data" << log_memory_info();
|
BOOST_LOG_TRIVIAL(debug) << "Preparing G-code preview data" << log_memory_info();
|
||||||
m_analyzer.calc_gcode_preview_data(*preview_data, [print]() { print->throw_if_canceled(); });
|
m_analyzer.calc_gcode_preview_data(*preview_data, [print]() { print->throw_if_canceled(); });
|
||||||
m_analyzer.reset();
|
m_analyzer.reset();
|
||||||
}
|
}
|
||||||
#endif // !ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
if (rename_file(path_tmp, path))
|
if (rename_file(path_tmp, path))
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
|
@ -820,6 +817,7 @@ void GCode::do_export(Print* print, const char* path, GCodePreviewData* preview_
|
||||||
|
|
||||||
// free functions called by GCode::_do_export()
|
// free functions called by GCode::_do_export()
|
||||||
namespace DoExport {
|
namespace DoExport {
|
||||||
|
#if !ENABLE_GCODE_VIEWER
|
||||||
static void init_time_estimators(const PrintConfig &config, GCodeTimeEstimator &normal_time_estimator, GCodeTimeEstimator &silent_time_estimator, bool &silent_time_estimator_enabled)
|
static void init_time_estimators(const PrintConfig &config, GCodeTimeEstimator &normal_time_estimator, GCodeTimeEstimator &silent_time_estimator, bool &silent_time_estimator_enabled)
|
||||||
{
|
{
|
||||||
// resets time estimators
|
// resets time estimators
|
||||||
|
@ -892,10 +890,12 @@ namespace DoExport {
|
||||||
normal_time_estimator.set_filament_unload_times(config.filament_unload_time.values);
|
normal_time_estimator.set_filament_unload_times(config.filament_unload_time.values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
static void init_gcode_processor(const PrintConfig& config, GCodeProcessor& processor, bool silent_time_estimator_enabled)
|
static void init_gcode_processor(const PrintConfig& config, GCodeProcessor& processor, bool& silent_time_estimator_enabled)
|
||||||
{
|
{
|
||||||
|
silent_time_estimator_enabled = (config.gcode_flavor == gcfMarlin) && config.silent_mode;
|
||||||
processor.reset();
|
processor.reset();
|
||||||
processor.apply_config(config);
|
processor.apply_config(config);
|
||||||
processor.enable_stealth_time_estimator(silent_time_estimator_enabled);
|
processor.enable_stealth_time_estimator(silent_time_estimator_enabled);
|
||||||
|
@ -1049,9 +1049,11 @@ namespace DoExport {
|
||||||
|
|
||||||
// Fill in print_statistics and return formatted string containing filament statistics to be inserted into G-code comment section.
|
// Fill in print_statistics and return formatted string containing filament statistics to be inserted into G-code comment section.
|
||||||
static std::string update_print_stats_and_format_filament_stats(
|
static std::string update_print_stats_and_format_filament_stats(
|
||||||
|
#if !ENABLE_GCODE_VIEWER
|
||||||
const GCodeTimeEstimator &normal_time_estimator,
|
const GCodeTimeEstimator &normal_time_estimator,
|
||||||
const GCodeTimeEstimator &silent_time_estimator,
|
const GCodeTimeEstimator &silent_time_estimator,
|
||||||
const bool silent_time_estimator_enabled,
|
const bool silent_time_estimator_enabled,
|
||||||
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
const bool has_wipe_tower,
|
const bool has_wipe_tower,
|
||||||
const WipeTowerData &wipe_tower_data,
|
const WipeTowerData &wipe_tower_data,
|
||||||
const std::vector<Extruder> &extruders,
|
const std::vector<Extruder> &extruders,
|
||||||
|
@ -1060,21 +1062,13 @@ namespace DoExport {
|
||||||
std::string filament_stats_string_out;
|
std::string filament_stats_string_out;
|
||||||
|
|
||||||
print_statistics.clear();
|
print_statistics.clear();
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if !ENABLE_GCODE_VIEWER
|
||||||
#if ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
print_statistics.estimated_normal_print_time_str = normal_time_estimator.get_time_dhm/*s*/();
|
|
||||||
print_statistics.estimated_silent_print_time_str = silent_time_estimator_enabled ? silent_time_estimator.get_time_dhm/*s*/() : "N/A";
|
|
||||||
print_statistics.estimated_normal_custom_gcode_print_times_str = normal_time_estimator.get_custom_gcode_times_dhm(true);
|
|
||||||
if (silent_time_estimator_enabled)
|
|
||||||
print_statistics.estimated_silent_custom_gcode_print_times_str = silent_time_estimator.get_custom_gcode_times_dhm(true);
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
#else
|
|
||||||
print_statistics.estimated_normal_print_time = normal_time_estimator.get_time_dhm/*s*/();
|
print_statistics.estimated_normal_print_time = normal_time_estimator.get_time_dhm/*s*/();
|
||||||
print_statistics.estimated_silent_print_time = silent_time_estimator_enabled ? silent_time_estimator.get_time_dhm/*s*/() : "N/A";
|
print_statistics.estimated_silent_print_time = silent_time_estimator_enabled ? silent_time_estimator.get_time_dhm/*s*/() : "N/A";
|
||||||
print_statistics.estimated_normal_custom_gcode_print_times = normal_time_estimator.get_custom_gcode_times_dhm(true);
|
print_statistics.estimated_normal_custom_gcode_print_times = normal_time_estimator.get_custom_gcode_times_dhm(true);
|
||||||
if (silent_time_estimator_enabled)
|
if (silent_time_estimator_enabled)
|
||||||
print_statistics.estimated_silent_custom_gcode_print_times = silent_time_estimator.get_custom_gcode_times_dhm(true);
|
print_statistics.estimated_silent_custom_gcode_print_times = silent_time_estimator.get_custom_gcode_times_dhm(true);
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
print_statistics.total_toolchanges = std::max(0, wipe_tower_data.number_of_toolchanges);
|
print_statistics.total_toolchanges = std::max(0, wipe_tower_data.number_of_toolchanges);
|
||||||
if (! extruders.empty()) {
|
if (! extruders.empty()) {
|
||||||
std::pair<std::string, unsigned int> out_filament_used_mm ("; filament used [mm] = ", 0);
|
std::pair<std::string, unsigned int> out_filament_used_mm ("; filament used [mm] = ", 0);
|
||||||
|
@ -1165,12 +1159,13 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
|
||||||
{
|
{
|
||||||
PROFILE_FUNC();
|
PROFILE_FUNC();
|
||||||
|
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
// modifies m_silent_time_estimator_enabled
|
||||||
|
DoExport::init_gcode_processor(print.config(), m_processor, m_silent_time_estimator_enabled);
|
||||||
|
#else
|
||||||
DoExport::init_time_estimators(print.config(),
|
DoExport::init_time_estimators(print.config(),
|
||||||
// modifies the following:
|
// modifies the following:
|
||||||
m_normal_time_estimator, m_silent_time_estimator, m_silent_time_estimator_enabled);
|
m_normal_time_estimator, m_silent_time_estimator, m_silent_time_estimator_enabled);
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
DoExport::init_gcode_processor(print.config(), m_processor, m_silent_time_estimator_enabled);
|
|
||||||
#else
|
|
||||||
DoExport::init_gcode_analyzer(print.config(), m_analyzer);
|
DoExport::init_gcode_analyzer(print.config(), m_analyzer);
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
|
@ -1274,12 +1269,13 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
|
||||||
print.throw_if_canceled();
|
print.throw_if_canceled();
|
||||||
|
|
||||||
// adds tags for time estimators
|
// adds tags for time estimators
|
||||||
if (print.config().remaining_times.value)
|
#if !ENABLE_GCODE_VIEWER
|
||||||
{
|
if (print.config().remaining_times.value) {
|
||||||
_writeln(file, GCodeTimeEstimator::Normal_First_M73_Output_Placeholder_Tag);
|
_writeln(file, GCodeTimeEstimator::Normal_First_M73_Output_Placeholder_Tag);
|
||||||
if (m_silent_time_estimator_enabled)
|
if (m_silent_time_estimator_enabled)
|
||||||
_writeln(file, GCodeTimeEstimator::Silent_First_M73_Output_Placeholder_Tag);
|
_writeln(file, GCodeTimeEstimator::Silent_First_M73_Output_Placeholder_Tag);
|
||||||
}
|
}
|
||||||
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
// Prepare the helper object for replacing placeholders in custom G-code and output filename.
|
// Prepare the helper object for replacing placeholders in custom G-code and output filename.
|
||||||
m_placeholder_parser = print.placeholder_parser();
|
m_placeholder_parser = print.placeholder_parser();
|
||||||
|
@ -1574,24 +1570,30 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
|
||||||
_write(file, m_writer.postamble());
|
_write(file, m_writer.postamble());
|
||||||
|
|
||||||
// adds tags for time estimators
|
// adds tags for time estimators
|
||||||
|
#if !ENABLE_GCODE_VIEWER
|
||||||
if (print.config().remaining_times.value)
|
if (print.config().remaining_times.value)
|
||||||
{
|
{
|
||||||
_writeln(file, GCodeTimeEstimator::Normal_Last_M73_Output_Placeholder_Tag);
|
_writeln(file, GCodeTimeEstimator::Normal_Last_M73_Output_Placeholder_Tag);
|
||||||
if (m_silent_time_estimator_enabled)
|
if (m_silent_time_estimator_enabled)
|
||||||
_writeln(file, GCodeTimeEstimator::Silent_Last_M73_Output_Placeholder_Tag);
|
_writeln(file, GCodeTimeEstimator::Silent_Last_M73_Output_Placeholder_Tag);
|
||||||
}
|
}
|
||||||
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
print.throw_if_canceled();
|
print.throw_if_canceled();
|
||||||
|
|
||||||
// calculates estimated printing time
|
// calculates estimated printing time
|
||||||
|
#if !ENABLE_GCODE_VIEWER
|
||||||
m_normal_time_estimator.calculate_time(false);
|
m_normal_time_estimator.calculate_time(false);
|
||||||
if (m_silent_time_estimator_enabled)
|
if (m_silent_time_estimator_enabled)
|
||||||
m_silent_time_estimator.calculate_time(false);
|
m_silent_time_estimator.calculate_time(false);
|
||||||
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
// Get filament stats.
|
// Get filament stats.
|
||||||
_write(file, DoExport::update_print_stats_and_format_filament_stats(
|
_write(file, DoExport::update_print_stats_and_format_filament_stats(
|
||||||
// Const inputs
|
// Const inputs
|
||||||
|
#if !ENABLE_GCODE_VIEWER
|
||||||
m_normal_time_estimator, m_silent_time_estimator, m_silent_time_estimator_enabled,
|
m_normal_time_estimator, m_silent_time_estimator, m_silent_time_estimator_enabled,
|
||||||
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
has_wipe_tower, print.wipe_tower_data(),
|
has_wipe_tower, print.wipe_tower_data(),
|
||||||
m_writer.extruders(),
|
m_writer.extruders(),
|
||||||
// Modifies
|
// Modifies
|
||||||
|
@ -1601,9 +1603,11 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
|
||||||
_write_format(file, "; total filament cost = %.1lf\n", print.m_print_statistics.total_cost);
|
_write_format(file, "; total filament cost = %.1lf\n", print.m_print_statistics.total_cost);
|
||||||
if (print.m_print_statistics.total_toolchanges > 0)
|
if (print.m_print_statistics.total_toolchanges > 0)
|
||||||
_write_format(file, "; total toolchanges = %i\n", print.m_print_statistics.total_toolchanges);
|
_write_format(file, "; total toolchanges = %i\n", print.m_print_statistics.total_toolchanges);
|
||||||
|
#if !ENABLE_GCODE_VIEWER
|
||||||
_write_format(file, "; estimated printing time (normal mode) = %s\n", m_normal_time_estimator.get_time_dhms().c_str());
|
_write_format(file, "; estimated printing time (normal mode) = %s\n", m_normal_time_estimator.get_time_dhms().c_str());
|
||||||
if (m_silent_time_estimator_enabled)
|
if (m_silent_time_estimator_enabled)
|
||||||
_write_format(file, "; estimated printing time (silent mode) = %s\n", m_silent_time_estimator.get_time_dhms().c_str());
|
_write_format(file, "; estimated printing time (silent mode) = %s\n", m_silent_time_estimator.get_time_dhms().c_str());
|
||||||
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
// Append full config.
|
// Append full config.
|
||||||
_write(file, "\n");
|
_write(file, "\n");
|
||||||
|
@ -1879,9 +1883,9 @@ namespace ProcessLayer
|
||||||
#else
|
#else
|
||||||
// add tag for analyzer
|
// add tag for analyzer
|
||||||
gcode += "; " + GCodeAnalyzer::Color_Change_Tag + ",T" + std::to_string(m600_extruder_before_layer) + "\n";
|
gcode += "; " + GCodeAnalyzer::Color_Change_Tag + ",T" + std::to_string(m600_extruder_before_layer) + "\n";
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
// add tag for time estimator
|
// add tag for time estimator
|
||||||
gcode += "; " + GCodeTimeEstimator::Color_Change_Tag + "\n";
|
gcode += "; " + GCodeTimeEstimator::Color_Change_Tag + "\n";
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
if (!single_extruder_printer && m600_extruder_before_layer >= 0 && first_extruder_id != (unsigned)m600_extruder_before_layer
|
if (!single_extruder_printer && m600_extruder_before_layer >= 0 && first_extruder_id != (unsigned)m600_extruder_before_layer
|
||||||
// && !MMU1
|
// && !MMU1
|
||||||
|
@ -1910,9 +1914,11 @@ namespace ProcessLayer
|
||||||
//! FIXME_in_fw show message during print pause
|
//! FIXME_in_fw show message during print pause
|
||||||
if (!pause_print_msg.empty())
|
if (!pause_print_msg.empty())
|
||||||
gcode += "M117 " + pause_print_msg + "\n";
|
gcode += "M117 " + pause_print_msg + "\n";
|
||||||
|
#if !ENABLE_GCODE_VIEWER
|
||||||
// add tag for time estimator
|
// add tag for time estimator
|
||||||
gcode += "; " + GCodeTimeEstimator::Pause_Print_Tag + "\n";
|
gcode += "; " + GCodeTimeEstimator::Pause_Print_Tag + "\n";
|
||||||
gcode += config.pause_print_gcode;
|
gcode += config.pause_print_gcode;
|
||||||
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2422,14 +2428,14 @@ void GCode::process_layer(
|
||||||
#endif /* HAS_PRESSURE_EQUALIZER */
|
#endif /* HAS_PRESSURE_EQUALIZER */
|
||||||
|
|
||||||
_write(file, gcode);
|
_write(file, gcode);
|
||||||
|
#if !ENABLE_GCODE_VIEWER
|
||||||
BOOST_LOG_TRIVIAL(trace) << "Exported layer " << layer.id() << " print_z " << print_z <<
|
BOOST_LOG_TRIVIAL(trace) << "Exported layer " << layer.id() << " print_z " << print_z <<
|
||||||
", time estimator memory: " <<
|
", time estimator memory: " <<
|
||||||
format_memsize_MB(m_normal_time_estimator.memory_used() + (m_silent_time_estimator_enabled ? m_silent_time_estimator.memory_used() : 0)) <<
|
format_memsize_MB(m_normal_time_estimator.memory_used() + (m_silent_time_estimator_enabled ? m_silent_time_estimator.memory_used() : 0)) <<
|
||||||
#if !ENABLE_GCODE_VIEWER
|
|
||||||
", analyzer memory: " <<
|
", analyzer memory: " <<
|
||||||
format_memsize_MB(m_analyzer.memory_used()) <<
|
format_memsize_MB(m_analyzer.memory_used()) <<
|
||||||
#endif // !ENABLE_GCODE_VIEWER
|
|
||||||
log_memory_info();
|
log_memory_info();
|
||||||
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
}
|
}
|
||||||
|
|
||||||
void GCode::apply_print_config(const PrintConfig &print_config)
|
void GCode::apply_print_config(const PrintConfig &print_config)
|
||||||
|
@ -3078,10 +3084,12 @@ void GCode::_write(FILE* file, const char *what)
|
||||||
|
|
||||||
// writes string to file
|
// writes string to file
|
||||||
fwrite(gcode, 1, ::strlen(gcode), file);
|
fwrite(gcode, 1, ::strlen(gcode), file);
|
||||||
|
#if !ENABLE_GCODE_VIEWER
|
||||||
// updates time estimator and gcode lines vector
|
// updates time estimator and gcode lines vector
|
||||||
m_normal_time_estimator.add_gcode_block(gcode);
|
m_normal_time_estimator.add_gcode_block(gcode);
|
||||||
if (m_silent_time_estimator_enabled)
|
if (m_silent_time_estimator_enabled)
|
||||||
m_silent_time_estimator.add_gcode_block(gcode);
|
m_silent_time_estimator.add_gcode_block(gcode);
|
||||||
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
#include "GCode/GCodeProcessor.hpp"
|
#include "GCode/GCodeProcessor.hpp"
|
||||||
#else
|
#else
|
||||||
#include "GCode/Analyzer.hpp"
|
#include "GCode/Analyzer.hpp"
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
#include "GCodeTimeEstimator.hpp"
|
#include "GCodeTimeEstimator.hpp"
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
#include "EdgeGrid.hpp"
|
#include "EdgeGrid.hpp"
|
||||||
#include "GCode/ThumbnailData.hpp"
|
#include "GCode/ThumbnailData.hpp"
|
||||||
|
|
||||||
|
@ -179,8 +179,10 @@ public:
|
||||||
#endif // !ENABLE_GCODE_VIEWER
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
m_brim_done(false),
|
m_brim_done(false),
|
||||||
m_second_layer_things_done(false),
|
m_second_layer_things_done(false),
|
||||||
|
#if !ENABLE_GCODE_VIEWER
|
||||||
m_normal_time_estimator(GCodeTimeEstimator::Normal),
|
m_normal_time_estimator(GCodeTimeEstimator::Normal),
|
||||||
m_silent_time_estimator(GCodeTimeEstimator::Silent),
|
m_silent_time_estimator(GCodeTimeEstimator::Silent),
|
||||||
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
m_silent_time_estimator_enabled(false),
|
m_silent_time_estimator_enabled(false),
|
||||||
m_last_obj_copy(nullptr, Point(std::numeric_limits<coord_t>::max(), std::numeric_limits<coord_t>::max()))
|
m_last_obj_copy(nullptr, Point(std::numeric_limits<coord_t>::max(), std::numeric_limits<coord_t>::max()))
|
||||||
{}
|
{}
|
||||||
|
@ -405,9 +407,11 @@ private:
|
||||||
// Index of a last object copy extruded.
|
// Index of a last object copy extruded.
|
||||||
std::pair<const PrintObject*, Point> m_last_obj_copy;
|
std::pair<const PrintObject*, Point> m_last_obj_copy;
|
||||||
|
|
||||||
|
#if !ENABLE_GCODE_VIEWER
|
||||||
// Time estimators
|
// Time estimators
|
||||||
GCodeTimeEstimator m_normal_time_estimator;
|
GCodeTimeEstimator m_normal_time_estimator;
|
||||||
GCodeTimeEstimator m_silent_time_estimator;
|
GCodeTimeEstimator m_silent_time_estimator;
|
||||||
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
bool m_silent_time_estimator_enabled;
|
bool m_silent_time_estimator_enabled;
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include <boost/nowide/cstdio.hpp>
|
#include <boost/nowide/cstdio.hpp>
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
|
|
||||||
|
#if !ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
static const float MMMIN_TO_MMSEC = 1.0f / 60.0f;
|
static const float MMMIN_TO_MMSEC = 1.0f / 60.0f;
|
||||||
static const float MILLISEC_TO_SEC = 0.001f;
|
static const float MILLISEC_TO_SEC = 0.001f;
|
||||||
static const float INCHES_TO_MM = 25.4f;
|
static const float INCHES_TO_MM = 25.4f;
|
||||||
|
@ -722,24 +724,6 @@ namespace Slic3r {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
#if ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
std::vector<std::pair<CustomGCode::Type, std::pair<std::string, std::string>>> GCodeTimeEstimator::get_custom_gcode_times_dhm(bool include_remaining) const
|
|
||||||
{
|
|
||||||
std::vector<std::pair<CustomGCode::Type, std::pair<std::string, std::string>>> ret;
|
|
||||||
|
|
||||||
float total_time = 0.0f;
|
|
||||||
for (const auto& [type, time] : m_custom_gcode_times) {
|
|
||||||
std::string duration = _get_time_dhm(time);
|
|
||||||
std::string remaining = include_remaining ? _get_time_dhm(m_time - total_time) : "";
|
|
||||||
ret.push_back({ type, { duration, remaining } });
|
|
||||||
total_time += time;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
#else
|
|
||||||
std::vector<std::pair<CustomGCode::Type, std::string>> GCodeTimeEstimator::get_custom_gcode_times_dhm(bool include_remaining) const
|
std::vector<std::pair<CustomGCode::Type, std::string>> GCodeTimeEstimator::get_custom_gcode_times_dhm(bool include_remaining) const
|
||||||
{
|
{
|
||||||
std::vector<std::pair<CustomGCode::Type, std::string>> ret;
|
std::vector<std::pair<CustomGCode::Type, std::string>> ret;
|
||||||
|
@ -760,7 +744,6 @@ namespace Slic3r {
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
|
|
||||||
// Return an estimate of the memory consumed by the time estimator.
|
// Return an estimate of the memory consumed by the time estimator.
|
||||||
size_t GCodeTimeEstimator::memory_used() const
|
size_t GCodeTimeEstimator::memory_used() const
|
||||||
|
@ -1690,3 +1673,5 @@ namespace Slic3r {
|
||||||
}
|
}
|
||||||
#endif // ENABLE_MOVE_STATS
|
#endif // ENABLE_MOVE_STATS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "GCodeReader.hpp"
|
#include "GCodeReader.hpp"
|
||||||
#include "CustomGCode.hpp"
|
#include "CustomGCode.hpp"
|
||||||
|
|
||||||
|
#if !ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
#define ENABLE_MOVE_STATS 0
|
#define ENABLE_MOVE_STATS 0
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
@ -370,13 +372,7 @@ namespace Slic3r {
|
||||||
|
|
||||||
// Returns the estimated time, in format DDd HHh MMm, for each custom_gcode
|
// Returns the estimated time, in format DDd HHh MMm, for each custom_gcode
|
||||||
// If include_remaining==true the strings will be formatted as: "time for custom_gcode (remaining time at color start)"
|
// If include_remaining==true the strings will be formatted as: "time for custom_gcode (remaining time at color start)"
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
#if ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
std::vector<std::pair<CustomGCode::Type, std::pair<std::string, std::string>>> get_custom_gcode_times_dhm(bool include_remaining) const;
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
#else
|
|
||||||
std::vector<std::pair<CustomGCode::Type, std::string>> get_custom_gcode_times_dhm(bool include_remaining) const;
|
std::vector<std::pair<CustomGCode::Type, std::string>> get_custom_gcode_times_dhm(bool include_remaining) const;
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
|
|
||||||
// Return an estimate of the memory consumed by the time estimator.
|
// Return an estimate of the memory consumed by the time estimator.
|
||||||
size_t memory_used() const;
|
size_t memory_used() const;
|
||||||
|
@ -487,4 +483,6 @@ namespace Slic3r {
|
||||||
|
|
||||||
} /* namespace Slic3r */
|
} /* namespace Slic3r */
|
||||||
|
|
||||||
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
#endif /* slic3r_GCodeTimeEstimator_hpp_ */
|
#endif /* slic3r_GCodeTimeEstimator_hpp_ */
|
||||||
|
|
|
@ -2190,23 +2190,13 @@ std::string Print::output_filename(const std::string &filename_base) const
|
||||||
DynamicConfig PrintStatistics::config() const
|
DynamicConfig PrintStatistics::config() const
|
||||||
{
|
{
|
||||||
DynamicConfig config;
|
DynamicConfig config;
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if !ENABLE_GCODE_VIEWER
|
||||||
#if ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
config.set_key_value("print_time", new ConfigOptionString(this->estimated_normal_print_time_str));
|
|
||||||
config.set_key_value("normal_print_time", new ConfigOptionString(this->estimated_normal_print_time_str));
|
|
||||||
config.set_key_value("silent_print_time", new ConfigOptionString(this->estimated_silent_print_time_str));
|
|
||||||
#else
|
|
||||||
config.set_key_value("print_time", new ConfigOptionString(short_time(get_time_dhms(this->estimated_normal_print_time))));
|
|
||||||
config.set_key_value("normal_print_time", new ConfigOptionString(short_time(get_time_dhms(this->estimated_normal_print_time))));
|
|
||||||
config.set_key_value("silent_print_time", new ConfigOptionString(short_time(get_time_dhms(this->estimated_silent_print_time))));
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
#else
|
|
||||||
std::string normal_print_time = short_time(this->estimated_normal_print_time);
|
std::string normal_print_time = short_time(this->estimated_normal_print_time);
|
||||||
std::string silent_print_time = short_time(this->estimated_silent_print_time);
|
std::string silent_print_time = short_time(this->estimated_silent_print_time);
|
||||||
config.set_key_value("print_time", new ConfigOptionString(normal_print_time));
|
config.set_key_value("print_time", new ConfigOptionString(normal_print_time));
|
||||||
config.set_key_value("normal_print_time", new ConfigOptionString(normal_print_time));
|
config.set_key_value("normal_print_time", new ConfigOptionString(normal_print_time));
|
||||||
config.set_key_value("silent_print_time", new ConfigOptionString(silent_print_time));
|
config.set_key_value("silent_print_time", new ConfigOptionString(silent_print_time));
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
config.set_key_value("used_filament", new ConfigOptionFloat(this->total_used_filament / 1000.));
|
config.set_key_value("used_filament", new ConfigOptionFloat(this->total_used_filament / 1000.));
|
||||||
config.set_key_value("extruded_volume", new ConfigOptionFloat(this->total_extruded_volume));
|
config.set_key_value("extruded_volume", new ConfigOptionFloat(this->total_extruded_volume));
|
||||||
config.set_key_value("total_cost", new ConfigOptionFloat(this->total_cost));
|
config.set_key_value("total_cost", new ConfigOptionFloat(this->total_cost));
|
||||||
|
|
|
@ -303,19 +303,12 @@ private:
|
||||||
struct PrintStatistics
|
struct PrintStatistics
|
||||||
{
|
{
|
||||||
PrintStatistics() { clear(); }
|
PrintStatistics() { clear(); }
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if !ENABLE_GCODE_VIEWER
|
||||||
#if ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
std::string estimated_normal_print_time_str;
|
|
||||||
std::string estimated_silent_print_time_str;
|
|
||||||
std::vector<std::pair<CustomGCode::Type, std::pair<std::string, std::string>>> estimated_normal_custom_gcode_print_times_str;
|
|
||||||
std::vector<std::pair<CustomGCode::Type, std::pair<std::string, std::string>>> estimated_silent_custom_gcode_print_times_str;
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
#else
|
|
||||||
std::string estimated_normal_print_time;
|
std::string estimated_normal_print_time;
|
||||||
std::string estimated_silent_print_time;
|
std::string estimated_silent_print_time;
|
||||||
std::vector<std::pair<CustomGCode::Type, std::string>> estimated_normal_custom_gcode_print_times;
|
std::vector<std::pair<CustomGCode::Type, std::string>> estimated_normal_custom_gcode_print_times;
|
||||||
std::vector<std::pair<CustomGCode::Type, std::string>> estimated_silent_custom_gcode_print_times;
|
std::vector<std::pair<CustomGCode::Type, std::string>> estimated_silent_custom_gcode_print_times;
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
double total_used_filament;
|
double total_used_filament;
|
||||||
double total_extruded_volume;
|
double total_extruded_volume;
|
||||||
double total_cost;
|
double total_cost;
|
||||||
|
@ -333,19 +326,12 @@ struct PrintStatistics
|
||||||
std::string finalize_output_path(const std::string &path_in) const;
|
std::string finalize_output_path(const std::string &path_in) const;
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if !ENABLE_GCODE_VIEWER
|
||||||
#if ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
estimated_normal_print_time_str.clear();
|
|
||||||
estimated_silent_print_time_str.clear();
|
|
||||||
estimated_normal_custom_gcode_print_times_str.clear();
|
|
||||||
estimated_silent_custom_gcode_print_times_str.clear();
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
#else
|
|
||||||
estimated_normal_print_time.clear();
|
estimated_normal_print_time.clear();
|
||||||
estimated_silent_print_time.clear();
|
estimated_silent_print_time.clear();
|
||||||
estimated_normal_custom_gcode_print_times.clear();
|
estimated_normal_custom_gcode_print_times.clear();
|
||||||
estimated_silent_custom_gcode_print_times.clear();
|
estimated_silent_custom_gcode_print_times.clear();
|
||||||
#endif //ENABLE_GCODE_VIEWER
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
total_used_filament = 0.;
|
total_used_filament = 0.;
|
||||||
total_extruded_volume = 0.;
|
total_extruded_volume = 0.;
|
||||||
total_cost = 0.;
|
total_cost = 0.;
|
||||||
|
|
|
@ -58,7 +58,11 @@
|
||||||
#define ENABLE_GCODE_VIEWER (1 && ENABLE_2_3_0_ALPHA1)
|
#define ENABLE_GCODE_VIEWER (1 && ENABLE_2_3_0_ALPHA1)
|
||||||
#define ENABLE_GCODE_VIEWER_STATISTICS (0 && ENABLE_GCODE_VIEWER)
|
#define ENABLE_GCODE_VIEWER_STATISTICS (0 && ENABLE_GCODE_VIEWER)
|
||||||
#define ENABLE_GCODE_VIEWER_SHADERS_EDITOR (0 && ENABLE_GCODE_VIEWER)
|
#define ENABLE_GCODE_VIEWER_SHADERS_EDITOR (0 && ENABLE_GCODE_VIEWER)
|
||||||
#define ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR (1 && ENABLE_GCODE_VIEWER)
|
|
||||||
#define ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG (1 && ENABLE_GCODE_VIEWER)
|
#define TIME_ESTIMATE_NONE 0
|
||||||
|
#define TIME_ESTIMATE_DEFAULT 1
|
||||||
|
#define TIME_ESTIMATE_MODAL 2
|
||||||
|
#define TIME_ESTIMATE_LEGEND 3
|
||||||
|
#define GCODE_VIEWER_TIME_ESTIMATE TIME_ESTIMATE_MODAL
|
||||||
|
|
||||||
#endif // _prusaslicer_technologies_h_
|
#endif // _prusaslicer_technologies_h_
|
||||||
|
|
|
@ -332,7 +332,9 @@ void GCodeViewer::load(const GCodeProcessor::Result& gcode_result, const Print&
|
||||||
wxGetApp().plater()->set_bed_shape(bed_shape, "", "", true);
|
wxGetApp().plater()->set_bed_shape(bed_shape, "", "", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if GCODE_VIEWER_TIME_ESTIMATE != TIME_ESTIMATE_NONE
|
||||||
m_time_statistics = gcode_result.time_statistics;
|
m_time_statistics = gcode_result.time_statistics;
|
||||||
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
}
|
}
|
||||||
|
|
||||||
void GCodeViewer::refresh(const GCodeProcessor::Result& gcode_result, const std::vector<std::string>& str_tool_colors)
|
void GCodeViewer::refresh(const GCodeProcessor::Result& gcode_result, const std::vector<std::string>& str_tool_colors)
|
||||||
|
@ -406,7 +408,9 @@ void GCodeViewer::reset()
|
||||||
m_layers_zs = std::vector<double>();
|
m_layers_zs = std::vector<double>();
|
||||||
m_layers_z_range = { 0.0, 0.0 };
|
m_layers_z_range = { 0.0, 0.0 };
|
||||||
m_roles = std::vector<ExtrusionRole>();
|
m_roles = std::vector<ExtrusionRole>();
|
||||||
|
#if GCODE_VIEWER_TIME_ESTIMATE != TIME_ESTIMATE_NONE
|
||||||
m_time_statistics.reset();
|
m_time_statistics.reset();
|
||||||
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
m_statistics.reset_all();
|
m_statistics.reset_all();
|
||||||
|
@ -419,7 +423,7 @@ void GCodeViewer::render() const
|
||||||
m_statistics.reset_opengl();
|
m_statistics.reset_opengl();
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#if GCODE_VIEWER_TIME_ESTIMATE == TIME_ESTIMATE_MODAL
|
||||||
if (m_roles.empty()) {
|
if (m_roles.empty()) {
|
||||||
m_time_estimate_frames_count = 0;
|
m_time_estimate_frames_count = 0;
|
||||||
return;
|
return;
|
||||||
|
@ -427,7 +431,7 @@ void GCodeViewer::render() const
|
||||||
#else
|
#else
|
||||||
if (m_roles.empty())
|
if (m_roles.empty())
|
||||||
return;
|
return;
|
||||||
#endif // ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
|
|
||||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||||
render_toolpaths();
|
render_toolpaths();
|
||||||
|
@ -435,7 +439,9 @@ void GCodeViewer::render() const
|
||||||
m_sequential_view.marker.render();
|
m_sequential_view.marker.render();
|
||||||
render_shells();
|
render_shells();
|
||||||
render_legend();
|
render_legend();
|
||||||
|
#if GCODE_VIEWER_TIME_ESTIMATE != TIME_ESTIMATE_NONE
|
||||||
render_time_estimate();
|
render_time_estimate();
|
||||||
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
render_statistics();
|
render_statistics();
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
@ -474,9 +480,9 @@ unsigned int GCodeViewer::get_options_visibility_flags() const
|
||||||
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::Shells), m_shells.visible);
|
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::Shells), m_shells.visible);
|
||||||
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::ToolMarker), m_sequential_view.marker.is_visible());
|
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::ToolMarker), m_sequential_view.marker.is_visible());
|
||||||
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::Legend), is_legend_enabled());
|
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::Legend), is_legend_enabled());
|
||||||
#if !ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#if GCODE_VIEWER_TIME_ESTIMATE == TIME_ESTIMATE_DEFAULT
|
||||||
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::TimeEstimate), is_time_estimate_enabled());
|
flags = set_flag(flags, static_cast<unsigned int>(Preview::OptionType::TimeEstimate), is_time_estimate_enabled());
|
||||||
#endif // !ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,9 +502,9 @@ void GCodeViewer::set_options_visibility_from_flags(unsigned int flags)
|
||||||
m_shells.visible = is_flag_set(static_cast<unsigned int>(Preview::OptionType::Shells));
|
m_shells.visible = is_flag_set(static_cast<unsigned int>(Preview::OptionType::Shells));
|
||||||
m_sequential_view.marker.set_visible(is_flag_set(static_cast<unsigned int>(Preview::OptionType::ToolMarker)));
|
m_sequential_view.marker.set_visible(is_flag_set(static_cast<unsigned int>(Preview::OptionType::ToolMarker)));
|
||||||
enable_legend(is_flag_set(static_cast<unsigned int>(Preview::OptionType::Legend)));
|
enable_legend(is_flag_set(static_cast<unsigned int>(Preview::OptionType::Legend)));
|
||||||
#if !ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#if GCODE_VIEWER_TIME_ESTIMATE == TIME_ESTIMATE_DEFAULT
|
||||||
enable_time_estimate(is_flag_set(static_cast<unsigned int>(Preview::OptionType::TimeEstimate)));
|
enable_time_estimate(is_flag_set(static_cast<unsigned int>(Preview::OptionType::TimeEstimate)));
|
||||||
#endif // !ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
}
|
}
|
||||||
|
|
||||||
void GCodeViewer::set_layers_z_range(const std::array<double, 2>& layers_z_range)
|
void GCodeViewer::set_layers_z_range(const std::array<double, 2>& layers_z_range)
|
||||||
|
@ -510,6 +516,7 @@ void GCodeViewer::set_layers_z_range(const std::array<double, 2>& layers_z_range
|
||||||
wxGetApp().plater()->update_preview_moves_slider();
|
wxGetApp().plater()->update_preview_moves_slider();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if GCODE_VIEWER_TIME_ESTIMATE != TIME_ESTIMATE_NONE
|
||||||
void GCodeViewer::enable_time_estimate(bool enable)
|
void GCodeViewer::enable_time_estimate(bool enable)
|
||||||
{
|
{
|
||||||
m_time_estimate_enabled = enable;
|
m_time_estimate_enabled = enable;
|
||||||
|
@ -517,6 +524,7 @@ void GCodeViewer::enable_time_estimate(bool enable)
|
||||||
wxGetApp().plater()->get_current_canvas3D()->set_as_dirty();
|
wxGetApp().plater()->get_current_canvas3D()->set_as_dirty();
|
||||||
wxGetApp().plater()->get_current_canvas3D()->request_extra_frame();
|
wxGetApp().plater()->get_current_canvas3D()->request_extra_frame();
|
||||||
}
|
}
|
||||||
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
|
|
||||||
void GCodeViewer::export_toolpaths_to_obj(const char* filename) const
|
void GCodeViewer::export_toolpaths_to_obj(const char* filename) const
|
||||||
{
|
{
|
||||||
|
@ -1682,24 +1690,25 @@ void GCodeViewer::render_legend() const
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if GCODE_VIEWER_TIME_ESTIMATE != TIME_ESTIMATE_NONE
|
||||||
void GCodeViewer::render_time_estimate() const
|
void GCodeViewer::render_time_estimate() const
|
||||||
{
|
{
|
||||||
if (!m_time_estimate_enabled) {
|
if (!m_time_estimate_enabled) {
|
||||||
#if ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#if GCODE_VIEWER_TIME_ESTIMATE == TIME_ESTIMATE_MODAL
|
||||||
m_time_estimate_frames_count = 0;
|
m_time_estimate_frames_count = 0;
|
||||||
#endif // ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiWrapper& imgui = *wxGetApp().imgui();
|
ImGuiWrapper& imgui = *wxGetApp().imgui();
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#if GCODE_VIEWER_TIME_ESTIMATE == TIME_ESTIMATE_MODAL
|
||||||
// esc
|
// esc
|
||||||
if (ImGui::GetIO().KeysDown[27]) {
|
if (ImGui::GetIO().KeysDown[27]) {
|
||||||
m_time_estimate_enabled = false;
|
m_time_estimate_enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
|
|
||||||
using Times = std::pair<float, float>;
|
using Times = std::pair<float, float>;
|
||||||
using TimesList = std::vector<std::pair<CustomGCode::Type, Times>>;
|
using TimesList = std::vector<std::pair<CustomGCode::Type, Times>>;
|
||||||
|
@ -1833,7 +1842,7 @@ void GCodeViewer::render_time_estimate() const
|
||||||
imgui.text(short_time(get_time_dhms(time)));
|
imgui.text(short_time(get_time_dhms(time)));
|
||||||
ImGui::SameLine(offsets[1]);
|
ImGui::SameLine(offsets[1]);
|
||||||
char buf[64];
|
char buf[64];
|
||||||
::sprintf(buf, "%.2f%%", 100.0f * percentage);
|
::sprintf(buf, "%.1f%%", 100.0f * percentage);
|
||||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||||
ImRect frame_bb;
|
ImRect frame_bb;
|
||||||
frame_bb.Min = { ImGui::GetCursorScreenPos().x, window->DC.CursorPos.y };
|
frame_bb.Min = { ImGui::GetCursorScreenPos().x, window->DC.CursorPos.y };
|
||||||
|
@ -1978,7 +1987,7 @@ void GCodeViewer::render_time_estimate() const
|
||||||
};
|
};
|
||||||
|
|
||||||
Size cnv_size = wxGetApp().plater()->get_current_canvas3D()->get_canvas_size();
|
Size cnv_size = wxGetApp().plater()->get_current_canvas3D()->get_canvas_size();
|
||||||
#if ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#if GCODE_VIEWER_TIME_ESTIMATE == TIME_ESTIMATE_MODAL
|
||||||
std::string title = _u8L("Estimated printing time");
|
std::string title = _u8L("Estimated printing time");
|
||||||
ImGui::OpenPopup(title.c_str());
|
ImGui::OpenPopup(title.c_str());
|
||||||
|
|
||||||
|
@ -1996,14 +2005,14 @@ void GCodeViewer::render_time_estimate() const
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
imgui.set_next_window_pos(static_cast<float>(cnv_size.get_width()), static_cast<float>(cnv_size.get_height()), ImGuiCond_Always, 1.0f, 1.0f);
|
imgui.set_next_window_pos(static_cast<float>(cnv_size.get_width()), static_cast<float>(cnv_size.get_height()), ImGuiCond_Always, 1.0f, 1.0f);
|
||||||
ImGui::SetNextWindowSizeConstraints({ 0.0f, 0.0f }, { -1.0f, 0.5f * static_cast<float>(cnv_size.get_height() }));
|
ImGui::SetNextWindowSizeConstraints({ 0.0f, 0.0f }, { -1.0f, 0.5f * static_cast<float>(cnv_size.get_height()) });
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||||
ImGui::SetNextWindowBgAlpha(0.6f);
|
ImGui::SetNextWindowBgAlpha(0.6f);
|
||||||
imgui.begin(std::string("Time_estimate"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove);
|
imgui.begin(std::string("Time_estimate"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove);
|
||||||
|
|
||||||
// title
|
// title
|
||||||
imgui.title(_u8L("Estimated printing time"));
|
imgui.title(_u8L("Estimated printing time"));
|
||||||
#endif // ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
|
|
||||||
// mode tabs
|
// mode tabs
|
||||||
ImGui::BeginTabBar("mode_tabs");
|
ImGui::BeginTabBar("mode_tabs");
|
||||||
|
@ -2029,7 +2038,7 @@ void GCodeViewer::render_time_estimate() const
|
||||||
}
|
}
|
||||||
ImGui::EndTabBar();
|
ImGui::EndTabBar();
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#if GCODE_VIEWER_TIME_ESTIMATE == TIME_ESTIMATE_MODAL
|
||||||
// this is ugly, but it is the only way to ensure that the dialog is large
|
// this is ugly, but it is the only way to ensure that the dialog is large
|
||||||
// enough to show enterely the title
|
// enough to show enterely the title
|
||||||
// see: https://github.com/ocornut/imgui/issues/3239
|
// see: https://github.com/ocornut/imgui/issues/3239
|
||||||
|
@ -2044,9 +2053,10 @@ void GCodeViewer::render_time_estimate() const
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
imgui.end();
|
imgui.end();
|
||||||
#endif // ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
}
|
}
|
||||||
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
void GCodeViewer::render_statistics() const
|
void GCodeViewer::render_statistics() const
|
||||||
|
|
|
@ -341,13 +341,15 @@ private:
|
||||||
Shells m_shells;
|
Shells m_shells;
|
||||||
EViewType m_view_type{ EViewType::FeatureType };
|
EViewType m_view_type{ EViewType::FeatureType };
|
||||||
bool m_legend_enabled{ true };
|
bool m_legend_enabled{ true };
|
||||||
|
#if GCODE_VIEWER_TIME_ESTIMATE != TIME_ESTIMATE_NONE
|
||||||
PrintEstimatedTimeStatistics m_time_statistics;
|
PrintEstimatedTimeStatistics m_time_statistics;
|
||||||
#if ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#if GCODE_VIEWER_TIME_ESTIMATE == TIME_ESTIMATE_MODAL
|
||||||
mutable bool m_time_estimate_enabled{ false };
|
mutable bool m_time_estimate_enabled{ false };
|
||||||
mutable unsigned int m_time_estimate_frames_count{ 0 };
|
mutable unsigned int m_time_estimate_frames_count{ 0 };
|
||||||
#else
|
#else
|
||||||
bool m_time_estimate_enabled{ false };
|
bool m_time_estimate_enabled{ false };
|
||||||
#endif // ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#endif // GCODE_VIEWER_TIME_ESTIMATE == TIME_ESTIMATE_MODAL
|
||||||
|
#endif // GCODE_VIEWER_TIME_ESTIMATE != TIME_ESTIMATE_NONE
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
mutable Statistics m_statistics;
|
mutable Statistics m_statistics;
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
@ -403,8 +405,10 @@ public:
|
||||||
bool is_legend_enabled() const { return m_legend_enabled; }
|
bool is_legend_enabled() const { return m_legend_enabled; }
|
||||||
void enable_legend(bool enable) { m_legend_enabled = enable; }
|
void enable_legend(bool enable) { m_legend_enabled = enable; }
|
||||||
|
|
||||||
|
#if GCODE_VIEWER_TIME_ESTIMATE != TIME_ESTIMATE_NONE
|
||||||
bool is_time_estimate_enabled() const { return m_time_estimate_enabled; }
|
bool is_time_estimate_enabled() const { return m_time_estimate_enabled; }
|
||||||
void enable_time_estimate(bool enable);
|
void enable_time_estimate(bool enable);
|
||||||
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
|
|
||||||
void export_toolpaths_to_obj(const char* filename) const;
|
void export_toolpaths_to_obj(const char* filename) const;
|
||||||
|
|
||||||
|
@ -416,7 +420,9 @@ private:
|
||||||
void render_toolpaths() const;
|
void render_toolpaths() const;
|
||||||
void render_shells() const;
|
void render_shells() const;
|
||||||
void render_legend() const;
|
void render_legend() const;
|
||||||
|
#if GCODE_VIEWER_TIME_ESTIMATE != TIME_ESTIMATE_NONE
|
||||||
void render_time_estimate() const;
|
void render_time_estimate() const;
|
||||||
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
void render_statistics() const;
|
void render_statistics() const;
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
|
|
@ -3109,9 +3109,10 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_RENDER_PICKING_PASS
|
#endif // ENABLE_RENDER_PICKING_PASS
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if GCODE_VIEWER_TIME_ESTIMATE == TIME_ESTIMATE_DEFAULT || GCODE_VIEWER_TIME_ESTIMATE == TIME_ESTIMATE_MODAL
|
||||||
case 'T':
|
case 'T':
|
||||||
case 't': {
|
case 't':
|
||||||
|
{
|
||||||
if (!m_main_toolbar.is_enabled()) {
|
if (!m_main_toolbar.is_enabled()) {
|
||||||
m_gcode_viewer.enable_time_estimate(!m_gcode_viewer.is_time_estimate_enabled());
|
m_gcode_viewer.enable_time_estimate(!m_gcode_viewer.is_time_estimate_enabled());
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
|
@ -3119,7 +3120,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
case 'Z':
|
case 'Z':
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
case 'z':
|
case 'z':
|
||||||
|
|
|
@ -558,7 +558,9 @@ public:
|
||||||
void reset_gcode_toolpaths() { m_gcode_viewer.reset(); }
|
void reset_gcode_toolpaths() { m_gcode_viewer.reset(); }
|
||||||
const GCodeViewer::SequentialView& get_gcode_sequential_view() const { return m_gcode_viewer.get_sequential_view(); }
|
const GCodeViewer::SequentialView& get_gcode_sequential_view() const { return m_gcode_viewer.get_sequential_view(); }
|
||||||
void update_gcode_sequential_view_current(unsigned int first, unsigned int last) { m_gcode_viewer.update_sequential_view_current(first, last); }
|
void update_gcode_sequential_view_current(unsigned int first, unsigned int last) { m_gcode_viewer.update_sequential_view_current(first, last); }
|
||||||
|
#if GCODE_VIEWER_TIME_ESTIMATE != TIME_ESTIMATE_NONE
|
||||||
bool is_time_estimate_enabled() const { return m_gcode_viewer.is_time_estimate_enabled(); }
|
bool is_time_estimate_enabled() const { return m_gcode_viewer.is_time_estimate_enabled(); }
|
||||||
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
void toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1);
|
void toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1);
|
||||||
|
|
|
@ -323,12 +323,12 @@ bool Preview::init(wxWindow* parent, Model* model)
|
||||||
get_option_type_string(OptionType::CustomGCodes) + "|0|" +
|
get_option_type_string(OptionType::CustomGCodes) + "|0|" +
|
||||||
get_option_type_string(OptionType::Shells) + "|0|" +
|
get_option_type_string(OptionType::Shells) + "|0|" +
|
||||||
get_option_type_string(OptionType::ToolMarker) + "|0|" +
|
get_option_type_string(OptionType::ToolMarker) + "|0|" +
|
||||||
#if ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#if GCODE_VIEWER_TIME_ESTIMATE == TIME_ESTIMATE_DEFAULT
|
||||||
get_option_type_string(OptionType::Legend) + "|1"
|
|
||||||
#else
|
|
||||||
get_option_type_string(OptionType::Legend) + "|1|" +
|
get_option_type_string(OptionType::Legend) + "|1|" +
|
||||||
get_option_type_string(OptionType::TimeEstimate) + "|1"
|
get_option_type_string(OptionType::TimeEstimate) + "|1"
|
||||||
#endif // ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#else
|
||||||
|
get_option_type_string(OptionType::Legend) + "|1"
|
||||||
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
);
|
);
|
||||||
Slic3r::GUI::create_combochecklist(m_combochecklist_options, GUI::into_u8(_L("Options")), options_items);
|
Slic3r::GUI::create_combochecklist(m_combochecklist_options, GUI::into_u8(_L("Options")), options_items);
|
||||||
#else
|
#else
|
||||||
|
@ -1459,7 +1459,9 @@ wxString Preview::get_option_type_string(OptionType type) const
|
||||||
case OptionType::Shells: { return _L("Shells"); }
|
case OptionType::Shells: { return _L("Shells"); }
|
||||||
case OptionType::ToolMarker: { return _L("Tool marker"); }
|
case OptionType::ToolMarker: { return _L("Tool marker"); }
|
||||||
case OptionType::Legend: { return _L("Legend"); }
|
case OptionType::Legend: { return _L("Legend"); }
|
||||||
|
#if GCODE_VIEWER_TIME_ESTIMATE != TIME_ESTIMATE_NONE
|
||||||
case OptionType::TimeEstimate: { return _L("Estimated printing time"); }
|
case OptionType::TimeEstimate: { return _L("Estimated printing time"); }
|
||||||
|
#endif // GCODE_VIEWER_TIME_ESTIMATE != TIME_ESTIMATE_NONE
|
||||||
default: { return ""; }
|
default: { return ""; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,9 @@ public:
|
||||||
Shells,
|
Shells,
|
||||||
ToolMarker,
|
ToolMarker,
|
||||||
Legend,
|
Legend,
|
||||||
|
#if GCODE_VIEWER_TIME_ESTIMATE != TIME_ESTIMATE_NONE
|
||||||
TimeEstimate
|
TimeEstimate
|
||||||
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
};
|
};
|
||||||
|
|
||||||
Preview(wxWindow* parent, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process,
|
Preview(wxWindow* parent, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process,
|
||||||
|
|
|
@ -204,13 +204,11 @@ void KBShortcutsDialog::fill_shortcuts()
|
||||||
{ "U", L("Upper Layer") },
|
{ "U", L("Upper Layer") },
|
||||||
{ "D", L("Lower Layer") },
|
{ "D", L("Lower Layer") },
|
||||||
{ "L", L("Show/Hide Legend") },
|
{ "L", L("Show/Hide Legend") },
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if GCODE_VIEWER_TIME_ESTIMATE == TIME_ESTIMATE_DEFAULT
|
||||||
#if ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
|
||||||
{ "T", L("Show Estimated printing time") }
|
|
||||||
#else
|
|
||||||
{ "T", L("Show/Hide Estimated printing time") }
|
{ "T", L("Show/Hide Estimated printing time") }
|
||||||
#endif // ENABLE_GCODE_VIEWER_MODAL_TIME_ESTIMATE_DIALOG
|
#elif GCODE_VIEWER_TIME_ESTIMATE == TIME_ESTIMATE_MODAL
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
{ "T", L("Show Estimated printing time") }
|
||||||
|
#endif // GCODE_VIEWER_TIME_ESTIMATE
|
||||||
};
|
};
|
||||||
|
|
||||||
m_full_shortcuts.push_back(std::make_pair(_L("Preview"), preview_shortcuts));
|
m_full_shortcuts.push_back(std::make_pair(_L("Preview"), preview_shortcuts));
|
||||||
|
|
|
@ -1324,15 +1324,10 @@ void Sidebar::update_sliced_info_sizer()
|
||||||
p->sliced_info->SetTextAndShow(siCost, info_text, new_label);
|
p->sliced_info->SetTextAndShow(siCost, info_text, new_label);
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
#if ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
// hide the estimate time
|
||||||
if (p->plater->get_current_canvas3D()->is_time_estimate_enabled() || (ps.estimated_normal_print_time_str == "N/A" && ps.estimated_silent_print_time_str == "N/A"))
|
p->sliced_info->SetTextAndShow(siEstimatedTime, "N/A");
|
||||||
#else
|
#else
|
||||||
if (p->plater->get_current_canvas3D()->is_time_estimate_enabled() || (ps.estimated_normal_print_time <= 0.0f && ps.estimated_silent_print_time <= 0.0f))
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
#else
|
|
||||||
|
|
||||||
if (ps.estimated_normal_print_time == "N/A" && ps.estimated_silent_print_time == "N/A")
|
if (ps.estimated_normal_print_time == "N/A" && ps.estimated_silent_print_time == "N/A")
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
p->sliced_info->SetTextAndShow(siEstimatedTime, "N/A");
|
p->sliced_info->SetTextAndShow(siEstimatedTime, "N/A");
|
||||||
else {
|
else {
|
||||||
new_label = _L("Estimated printing time") + ":";
|
new_label = _L("Estimated printing time") + ":";
|
||||||
|
@ -1340,15 +1335,7 @@ void Sidebar::update_sliced_info_sizer()
|
||||||
wxString str_color = _L("Color");
|
wxString str_color = _L("Color");
|
||||||
wxString str_pause = _L("Pause");
|
wxString str_pause = _L("Pause");
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
#if ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
auto fill_labels = [str_color, str_pause](const std::vector<std::pair<CustomGCode::Type, std::pair<std::string, std::string>>>& times,
|
|
||||||
#else
|
|
||||||
auto fill_labels = [str_color, str_pause](const std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>>& times,
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
#else
|
|
||||||
auto fill_labels = [str_color, str_pause](const std::vector<std::pair<CustomGCode::Type, std::string>>& times,
|
auto fill_labels = [str_color, str_pause](const std::vector<std::pair<CustomGCode::Type, std::string>>& times,
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
wxString& new_label, wxString& info_text)
|
wxString& new_label, wxString& info_text)
|
||||||
{
|
{
|
||||||
int color_change_count = 0;
|
int color_change_count = 0;
|
||||||
|
@ -1366,41 +1353,10 @@ void Sidebar::update_sliced_info_sizer()
|
||||||
if (i != (int)times.size() - 1 && times[i].first == CustomGCode::PausePrint)
|
if (i != (int)times.size() - 1 && times[i].first == CustomGCode::PausePrint)
|
||||||
new_label += format_wxstr(" -> %1%", str_pause);
|
new_label += format_wxstr(" -> %1%", str_pause);
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
#if ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
info_text += format_wxstr("\n%1% (%2%)", times[i].second.first, times[i].second.second);
|
|
||||||
#else
|
|
||||||
info_text += format_wxstr("\n%1% (%2%)", short_time(get_time_dhms(times[i].second.first)), short_time(get_time_dhms(times[i].second.second)));
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
#else
|
|
||||||
info_text += format_wxstr("\n%1%", times[i].second);
|
info_text += format_wxstr("\n%1%", times[i].second);
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
#if ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
if (ps.estimated_normal_print_time_str != "N/A") {
|
|
||||||
new_label += format_wxstr("\n - %1%", _L("normal mode"));
|
|
||||||
info_text += format_wxstr("\n%1%", ps.estimated_normal_print_time_str);
|
|
||||||
fill_labels(ps.estimated_normal_custom_gcode_print_times_str, new_label, info_text);
|
|
||||||
}
|
|
||||||
if (ps.estimated_silent_print_time_str != "N/A") {
|
|
||||||
new_label += format_wxstr("\n - %1%", _L("stealth mode"));
|
|
||||||
info_text += format_wxstr("\n%1%", ps.estimated_silent_print_time_str);
|
|
||||||
fill_labels(ps.estimated_silent_custom_gcode_print_times_str, new_label, info_text);
|
|
||||||
#else
|
|
||||||
if (ps.estimated_normal_print_time > 0.0f) {
|
|
||||||
new_label += format_wxstr("\n - %1%", _L("normal mode"));
|
|
||||||
info_text += format_wxstr("\n%1%", short_time(get_time_dhms(ps.estimated_normal_print_time)));
|
|
||||||
fill_labels(ps.estimated_normal_custom_gcode_print_times, new_label, info_text);
|
|
||||||
}
|
|
||||||
if (ps.estimated_silent_print_time > 0.0f) {
|
|
||||||
new_label += format_wxstr("\n - %1%", _L("stealth mode"));
|
|
||||||
info_text += format_wxstr("\n%1%", short_time(get_time_dhms(ps.estimated_silent_print_time)));
|
|
||||||
fill_labels(ps.estimated_silent_custom_gcode_print_times, new_label, info_text);
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_USE_OLD_TIME_ESTIMATOR
|
|
||||||
#else
|
|
||||||
if (ps.estimated_normal_print_time != "N/A") {
|
if (ps.estimated_normal_print_time != "N/A") {
|
||||||
new_label += format_wxstr("\n - %1%", _L("normal mode"));
|
new_label += format_wxstr("\n - %1%", _L("normal mode"));
|
||||||
info_text += format_wxstr("\n%1%", ps.estimated_normal_print_time);
|
info_text += format_wxstr("\n%1%", ps.estimated_normal_print_time);
|
||||||
|
@ -1416,10 +1372,10 @@ void Sidebar::update_sliced_info_sizer()
|
||||||
new_label += format_wxstr("\n - %1%", _L("stealth mode"));
|
new_label += format_wxstr("\n - %1%", _L("stealth mode"));
|
||||||
info_text += format_wxstr("\n%1%", ps.estimated_silent_print_time);
|
info_text += format_wxstr("\n%1%", ps.estimated_silent_print_time);
|
||||||
fill_labels(ps.estimated_silent_custom_gcode_print_times, new_label, info_text);
|
fill_labels(ps.estimated_silent_custom_gcode_print_times, new_label, info_text);
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
}
|
}
|
||||||
p->sliced_info->SetTextAndShow(siEstimatedTime, info_text, new_label);
|
p->sliced_info->SetTextAndShow(siEstimatedTime, info_text, new_label);
|
||||||
}
|
}
|
||||||
|
#endif // !ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
// if there is a wipe tower, insert number of toolchanges info into the array:
|
// if there is a wipe tower, insert number of toolchanges info into the array:
|
||||||
p->sliced_info->SetTextAndShow(siWTNumbetOfToolchanges, is_wipe_tower ? wxString::Format("%.d", ps.total_toolchanges) : "N/A");
|
p->sliced_info->SetTextAndShow(siWTNumbetOfToolchanges, is_wipe_tower ? wxString::Format("%.d", ps.total_toolchanges) : "N/A");
|
||||||
|
@ -1428,9 +1384,8 @@ void Sidebar::update_sliced_info_sizer()
|
||||||
p->sliced_info->SetTextAndShow(siMateril_unit, "N/A");
|
p->sliced_info->SetTextAndShow(siMateril_unit, "N/A");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
Layout();
|
Layout();
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sidebar::show_sliced_info_sizer(const bool show)
|
void Sidebar::show_sliced_info_sizer(const bool show)
|
||||||
|
|
Loading…
Reference in a new issue