mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-09-23 21:33:12 +08:00
Tech ENABLE_TRAVEL_TIME set as default
This commit is contained in:
parent
bb1b21513f
commit
32b2c90538
@ -199,9 +199,7 @@ void GCodeProcessor::TimeMachine::reset()
|
|||||||
max_travel_acceleration = 0.0f;
|
max_travel_acceleration = 0.0f;
|
||||||
extrude_factor_override_percentage = 1.0f;
|
extrude_factor_override_percentage = 1.0f;
|
||||||
time = 0.0f;
|
time = 0.0f;
|
||||||
#if ENABLE_TRAVEL_TIME
|
|
||||||
travel_time = 0.0f;
|
travel_time = 0.0f;
|
||||||
#endif // ENABLE_TRAVEL_TIME
|
|
||||||
stop_times = std::vector<StopTime>();
|
stop_times = std::vector<StopTime>();
|
||||||
curr.reset();
|
curr.reset();
|
||||||
prev.reset();
|
prev.reset();
|
||||||
@ -317,17 +315,12 @@ void GCodeProcessor::TimeMachine::calculate_time(size_t keep_last_n_blocks, floa
|
|||||||
block_time += additional_time;
|
block_time += additional_time;
|
||||||
|
|
||||||
time += block_time;
|
time += block_time;
|
||||||
#if ENABLE_TRAVEL_TIME
|
|
||||||
if (block.move_type == EMoveType::Travel)
|
if (block.move_type == EMoveType::Travel)
|
||||||
travel_time += block_time;
|
travel_time += block_time;
|
||||||
else
|
else
|
||||||
roles_time[static_cast<size_t>(block.role)] += block_time;
|
roles_time[static_cast<size_t>(block.role)] += block_time;
|
||||||
#endif // ENABLE_TRAVEL_TIME
|
|
||||||
gcode_time.cache += block_time;
|
gcode_time.cache += block_time;
|
||||||
moves_time[static_cast<size_t>(block.move_type)] += block_time;
|
moves_time[static_cast<size_t>(block.move_type)] += block_time;
|
||||||
#if !ENABLE_TRAVEL_TIME
|
|
||||||
roles_time[static_cast<size_t>(block.role)] += block_time;
|
|
||||||
#endif // !ENABLE_TRAVEL_TIME
|
|
||||||
if (block.layer_id >= layers_time.size()) {
|
if (block.layer_id >= layers_time.size()) {
|
||||||
const size_t curr_size = layers_time.size();
|
const size_t curr_size = layers_time.size();
|
||||||
layers_time.resize(block.layer_id);
|
layers_time.resize(block.layer_id);
|
||||||
@ -1465,7 +1458,6 @@ std::string GCodeProcessor::get_time_dhm(PrintEstimatedStatistics::ETimeMode mod
|
|||||||
return (mode < PrintEstimatedStatistics::ETimeMode::Count) ? short_time(get_time_dhms(m_time_processor.machines[static_cast<size_t>(mode)].time)) : std::string("N/A");
|
return (mode < PrintEstimatedStatistics::ETimeMode::Count) ? short_time(get_time_dhms(m_time_processor.machines[static_cast<size_t>(mode)].time)) : std::string("N/A");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_TRAVEL_TIME
|
|
||||||
float GCodeProcessor::get_travel_time(PrintEstimatedStatistics::ETimeMode mode) const
|
float GCodeProcessor::get_travel_time(PrintEstimatedStatistics::ETimeMode mode) const
|
||||||
{
|
{
|
||||||
return (mode < PrintEstimatedStatistics::ETimeMode::Count) ? m_time_processor.machines[static_cast<size_t>(mode)].travel_time : 0.0f;
|
return (mode < PrintEstimatedStatistics::ETimeMode::Count) ? m_time_processor.machines[static_cast<size_t>(mode)].travel_time : 0.0f;
|
||||||
@ -1475,7 +1467,6 @@ std::string GCodeProcessor::get_travel_time_dhm(PrintEstimatedStatistics::ETimeM
|
|||||||
{
|
{
|
||||||
return (mode < PrintEstimatedStatistics::ETimeMode::Count) ? short_time(get_time_dhms(m_time_processor.machines[static_cast<size_t>(mode)].travel_time)) : std::string("N/A");
|
return (mode < PrintEstimatedStatistics::ETimeMode::Count) ? short_time(get_time_dhms(m_time_processor.machines[static_cast<size_t>(mode)].travel_time)) : std::string("N/A");
|
||||||
}
|
}
|
||||||
#endif // ENABLE_TRAVEL_TIME
|
|
||||||
|
|
||||||
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> GCodeProcessor::get_custom_gcode_times(PrintEstimatedStatistics::ETimeMode mode, bool include_remaining) const
|
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> GCodeProcessor::get_custom_gcode_times(PrintEstimatedStatistics::ETimeMode mode, bool include_remaining) const
|
||||||
{
|
{
|
||||||
@ -4327,9 +4318,7 @@ void GCodeProcessor::update_estimated_times_stats()
|
|||||||
auto update_mode = [this](PrintEstimatedStatistics::ETimeMode mode) {
|
auto update_mode = [this](PrintEstimatedStatistics::ETimeMode mode) {
|
||||||
PrintEstimatedStatistics::Mode& data = m_result.print_statistics.modes[static_cast<size_t>(mode)];
|
PrintEstimatedStatistics::Mode& data = m_result.print_statistics.modes[static_cast<size_t>(mode)];
|
||||||
data.time = get_time(mode);
|
data.time = get_time(mode);
|
||||||
#if ENABLE_TRAVEL_TIME
|
|
||||||
data.travel_time = get_travel_time(mode);
|
data.travel_time = get_travel_time(mode);
|
||||||
#endif // ENABLE_TRAVEL_TIME
|
|
||||||
data.custom_gcode_times = get_custom_gcode_times(mode, true);
|
data.custom_gcode_times = get_custom_gcode_times(mode, true);
|
||||||
data.moves_times = get_moves_time(mode);
|
data.moves_times = get_moves_time(mode);
|
||||||
data.roles_times = get_roles_time(mode);
|
data.roles_times = get_roles_time(mode);
|
||||||
|
@ -44,9 +44,7 @@ namespace Slic3r {
|
|||||||
struct Mode
|
struct Mode
|
||||||
{
|
{
|
||||||
float time;
|
float time;
|
||||||
#if ENABLE_TRAVEL_TIME
|
|
||||||
float travel_time;
|
float travel_time;
|
||||||
#endif // ENABLE_TRAVEL_TIME
|
|
||||||
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> custom_gcode_times;
|
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> custom_gcode_times;
|
||||||
std::vector<std::pair<EMoveType, float>> moves_times;
|
std::vector<std::pair<EMoveType, float>> moves_times;
|
||||||
std::vector<std::pair<ExtrusionRole, float>> roles_times;
|
std::vector<std::pair<ExtrusionRole, float>> roles_times;
|
||||||
@ -54,9 +52,7 @@ namespace Slic3r {
|
|||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
time = 0.0f;
|
time = 0.0f;
|
||||||
#if ENABLE_TRAVEL_TIME
|
|
||||||
travel_time = 0.0f;
|
travel_time = 0.0f;
|
||||||
#endif // ENABLE_TRAVEL_TIME
|
|
||||||
custom_gcode_times.clear();
|
custom_gcode_times.clear();
|
||||||
moves_times.clear();
|
moves_times.clear();
|
||||||
roles_times.clear();
|
roles_times.clear();
|
||||||
@ -307,9 +303,7 @@ namespace Slic3r {
|
|||||||
float max_travel_acceleration; // mm/s^2
|
float max_travel_acceleration; // mm/s^2
|
||||||
float extrude_factor_override_percentage;
|
float extrude_factor_override_percentage;
|
||||||
float time; // s
|
float time; // s
|
||||||
#if ENABLE_TRAVEL_TIME
|
|
||||||
float travel_time; // s
|
float travel_time; // s
|
||||||
#endif // ENABLE_TRAVEL_TIME
|
|
||||||
struct StopTime
|
struct StopTime
|
||||||
{
|
{
|
||||||
unsigned int g1_line_id;
|
unsigned int g1_line_id;
|
||||||
@ -635,10 +629,8 @@ namespace Slic3r {
|
|||||||
|
|
||||||
float get_time(PrintEstimatedStatistics::ETimeMode mode) const;
|
float get_time(PrintEstimatedStatistics::ETimeMode mode) const;
|
||||||
std::string get_time_dhm(PrintEstimatedStatistics::ETimeMode mode) const;
|
std::string get_time_dhm(PrintEstimatedStatistics::ETimeMode mode) const;
|
||||||
#if ENABLE_TRAVEL_TIME
|
|
||||||
float get_travel_time(PrintEstimatedStatistics::ETimeMode mode) const;
|
float get_travel_time(PrintEstimatedStatistics::ETimeMode mode) const;
|
||||||
std::string get_travel_time_dhm(PrintEstimatedStatistics::ETimeMode mode) const;
|
std::string get_travel_time_dhm(PrintEstimatedStatistics::ETimeMode mode) const;
|
||||||
#endif // ENABLE_TRAVEL_TIME
|
|
||||||
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> get_custom_gcode_times(PrintEstimatedStatistics::ETimeMode mode, bool include_remaining) const;
|
std::vector<std::pair<CustomGCode::Type, std::pair<float, float>>> get_custom_gcode_times(PrintEstimatedStatistics::ETimeMode mode, bool include_remaining) const;
|
||||||
|
|
||||||
std::vector<std::pair<EMoveType, float>> get_moves_time(PrintEstimatedStatistics::ETimeMode mode) const;
|
std::vector<std::pair<EMoveType, float>> get_moves_time(PrintEstimatedStatistics::ETimeMode mode) const;
|
||||||
|
@ -43,8 +43,6 @@
|
|||||||
#define ENABLE_PREVIEW_LAYOUT (1 && ENABLE_2_5_0_ALPHA1)
|
#define ENABLE_PREVIEW_LAYOUT (1 && ENABLE_2_5_0_ALPHA1)
|
||||||
// Enable drawing the items in legend toolbar using icons
|
// Enable drawing the items in legend toolbar using icons
|
||||||
#define ENABLE_LEGEND_TOOLBAR_ICONS (1 && ENABLE_PREVIEW_LAYOUT)
|
#define ENABLE_LEGEND_TOOLBAR_ICONS (1 && ENABLE_PREVIEW_LAYOUT)
|
||||||
// Enable showing time estimate for travel moves in legend
|
|
||||||
#define ENABLE_TRAVEL_TIME (1 && ENABLE_2_5_0_ALPHA1)
|
|
||||||
// Enable removal of wipe tower magic object_id equal to 1000
|
// Enable removal of wipe tower magic object_id equal to 1000
|
||||||
#define ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL (1 && ENABLE_2_5_0_ALPHA1)
|
#define ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL (1 && ENABLE_2_5_0_ALPHA1)
|
||||||
// Enable removal of legacy OpenGL calls
|
// Enable removal of legacy OpenGL calls
|
||||||
|
@ -3537,7 +3537,6 @@ void GCodeViewer::render_legend(float& legend_height)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
imgui.text(label);
|
imgui.text(label);
|
||||||
#if ENABLE_TRAVEL_TIME
|
|
||||||
if (!time.empty()) {
|
if (!time.empty()) {
|
||||||
ImGui::SameLine(offsets[0]);
|
ImGui::SameLine(offsets[0]);
|
||||||
imgui.text(time);
|
imgui.text(time);
|
||||||
@ -3553,9 +3552,6 @@ void GCodeViewer::render_legend(float& legend_height)
|
|||||||
ImGui::TextUnformatted((percent > 0.0f) ? buf : "");
|
ImGui::TextUnformatted((percent > 0.0f) ? buf : "");
|
||||||
}
|
}
|
||||||
else if (used_filament_m > 0.0) {
|
else if (used_filament_m > 0.0) {
|
||||||
#else
|
|
||||||
if (used_filament_m > 0.0) {
|
|
||||||
#endif // ENABLE_TRAVEL_TIME
|
|
||||||
char buf[64];
|
char buf[64];
|
||||||
ImGui::SameLine(offsets[0]);
|
ImGui::SameLine(offsets[0]);
|
||||||
::sprintf(buf, imperial_units ? "%.2f in" : "%.2f m", used_filament_m);
|
::sprintf(buf, imperial_units ? "%.2f in" : "%.2f m", used_filament_m);
|
||||||
@ -3868,9 +3864,7 @@ void GCodeViewer::render_legend(float& legend_height)
|
|||||||
{
|
{
|
||||||
case EViewType::FeatureType:
|
case EViewType::FeatureType:
|
||||||
{
|
{
|
||||||
#if ENABLE_TRAVEL_TIME
|
|
||||||
max_time_percent = std::max(max_time_percent, time_mode.travel_time / time_mode.time);
|
max_time_percent = std::max(max_time_percent, time_mode.travel_time / time_mode.time);
|
||||||
#endif // ENABLE_TRAVEL_TIME
|
|
||||||
|
|
||||||
for (size_t i = 0; i < m_roles.size(); ++i) {
|
for (size_t i = 0; i < m_roles.size(); ++i) {
|
||||||
ExtrusionRole role = m_roles[i];
|
ExtrusionRole role = m_roles[i];
|
||||||
@ -3891,11 +3885,9 @@ void GCodeViewer::render_legend(float& legend_height)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_TRAVEL_TIME
|
|
||||||
if (m_buffers[buffer_id(EMoveType::Travel)].visible)
|
if (m_buffers[buffer_id(EMoveType::Travel)].visible)
|
||||||
append_item(EItemType::Line, Travel_Colors[0], _u8L("Travel"), true, short_time(get_time_dhms(time_mode.travel_time)),
|
append_item(EItemType::Line, Travel_Colors[0], _u8L("Travel"), true, short_time(get_time_dhms(time_mode.travel_time)),
|
||||||
time_mode.travel_time / time_mode.time, max_time_percent, offsets, 0.0f, 0.0f);
|
time_mode.travel_time / time_mode.time, max_time_percent, offsets, 0.0f, 0.0f);
|
||||||
#endif // ENABLE_TRAVEL_TIME
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user