Tech ENABLE_GCODE_LINES_ID_IN_H_SLIDER set as default
This commit is contained in:
parent
232309a879
commit
b80fb40fcd
12 changed files with 2 additions and 121 deletions
|
@ -155,10 +155,8 @@ void AppConfig::set_defaults()
|
||||||
if (get("seq_top_layer_only").empty())
|
if (get("seq_top_layer_only").empty())
|
||||||
set("seq_top_layer_only", "1");
|
set("seq_top_layer_only", "1");
|
||||||
|
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
if (get("seq_top_gcode_indices").empty())
|
if (get("seq_top_gcode_indices").empty())
|
||||||
set("seq_top_gcode_indices", "1");
|
set("seq_top_gcode_indices", "1");
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
|
|
||||||
if (get("use_perspective_camera").empty())
|
if (get("use_perspective_camera").empty())
|
||||||
set("use_perspective_camera", "1");
|
set("use_perspective_camera", "1");
|
||||||
|
|
|
@ -361,11 +361,7 @@ void GCodeProcessor::TimeProcessor::reset()
|
||||||
machines[static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Normal)].enabled = true;
|
machines[static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Normal)].enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, std::vector<MoveVertex>& moves)
|
void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, std::vector<MoveVertex>& moves)
|
||||||
#else
|
|
||||||
void GCodeProcessor::TimeProcessor::post_process(const std::string& filename)
|
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
{
|
{
|
||||||
boost::nowide::ifstream in(filename);
|
boost::nowide::ifstream in(filename);
|
||||||
if (!in.good())
|
if (!in.good())
|
||||||
|
@ -443,9 +439,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename)
|
||||||
|
|
||||||
// replace placeholder lines with the proper final value
|
// replace placeholder lines with the proper final value
|
||||||
auto process_placeholders = [&](const std::string& gcode_line) {
|
auto process_placeholders = [&](const std::string& gcode_line) {
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
unsigned int extra_lines_count = 0;
|
unsigned int extra_lines_count = 0;
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
|
|
||||||
// remove trailing '\n'
|
// remove trailing '\n'
|
||||||
std::string line = gcode_line.substr(0, gcode_line.length() - 1);
|
std::string line = gcode_line.substr(0, gcode_line.length() - 1);
|
||||||
|
@ -464,26 +458,20 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename)
|
||||||
ret += format_line_M73_main(machine.line_m73_main_mask.c_str(),
|
ret += format_line_M73_main(machine.line_m73_main_mask.c_str(),
|
||||||
(line == reserved_tag(ETags::First_Line_M73_Placeholder)) ? 0 : 100,
|
(line == reserved_tag(ETags::First_Line_M73_Placeholder)) ? 0 : 100,
|
||||||
(line == reserved_tag(ETags::First_Line_M73_Placeholder)) ? time_in_minutes(machine.time) : 0);
|
(line == reserved_tag(ETags::First_Line_M73_Placeholder)) ? time_in_minutes(machine.time) : 0);
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
++extra_lines_count;
|
++extra_lines_count;
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
|
|
||||||
// export remaining time to next printer stop
|
// export remaining time to next printer stop
|
||||||
if (line == reserved_tag(ETags::First_Line_M73_Placeholder) && !machine.stop_times.empty()) {
|
if (line == reserved_tag(ETags::First_Line_M73_Placeholder) && !machine.stop_times.empty()) {
|
||||||
int to_export_stop = time_in_minutes(machine.stop_times.front().elapsed_time);
|
int to_export_stop = time_in_minutes(machine.stop_times.front().elapsed_time);
|
||||||
ret += format_line_M73_stop_int(machine.line_m73_stop_mask.c_str(), to_export_stop);
|
ret += format_line_M73_stop_int(machine.line_m73_stop_mask.c_str(), to_export_stop);
|
||||||
last_exported_stop[i] = to_export_stop;
|
last_exported_stop[i] = to_export_stop;
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
++extra_lines_count;
|
++extra_lines_count;
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ret += format_line_M73(machine.line_m73_mask.c_str(),
|
ret += format_line_M73(machine.line_m73_mask.c_str(),
|
||||||
(line == reserved_tag(ETags::First_Line_M73_Placeholder)) ? 0 : 100,
|
(line == reserved_tag(ETags::First_Line_M73_Placeholder)) ? 0 : 100,
|
||||||
(line == reserved_tag(ETags::First_Line_M73_Placeholder)) ? time_in_minutes(machine.time) : 0);
|
(line == reserved_tag(ETags::First_Line_M73_Placeholder)) ? time_in_minutes(machine.time) : 0);
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
++extra_lines_count;
|
++extra_lines_count;
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
#endif // ENABLE_EXTENDED_M73_LINES
|
#endif // ENABLE_EXTENDED_M73_LINES
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -518,11 +506,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename)
|
||||||
}
|
}
|
||||||
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
#endif // ENABLE_VALIDATE_CUSTOM_GCODE
|
||||||
|
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
return std::tuple(!ret.empty(), ret.empty() ? gcode_line : ret, (extra_lines_count == 0) ? extra_lines_count : extra_lines_count - 1);
|
return std::tuple(!ret.empty(), ret.empty() ? gcode_line : ret, (extra_lines_count == 0) ? extra_lines_count : extra_lines_count - 1);
|
||||||
#else
|
|
||||||
return std::make_pair(!ret.empty(), ret.empty() ? gcode_line : ret);
|
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// check for temporary lines
|
// check for temporary lines
|
||||||
|
@ -546,9 +530,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename)
|
||||||
|
|
||||||
// add lines M73 to exported gcode
|
// add lines M73 to exported gcode
|
||||||
auto process_line_G1 = [&]() {
|
auto process_line_G1 = [&]() {
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
unsigned int exported_lines_count = 0;
|
unsigned int exported_lines_count = 0;
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
if (export_remaining_time_enabled) {
|
if (export_remaining_time_enabled) {
|
||||||
for (size_t i = 0; i < static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count); ++i) {
|
for (size_t i = 0; i < static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count); ++i) {
|
||||||
const TimeMachine& machine = machines[i];
|
const TimeMachine& machine = machines[i];
|
||||||
|
@ -566,9 +548,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename)
|
||||||
export_line += format_line_M73_main(machine.line_m73_main_mask.c_str(),
|
export_line += format_line_M73_main(machine.line_m73_main_mask.c_str(),
|
||||||
to_export_main.first, to_export_main.second);
|
to_export_main.first, to_export_main.second);
|
||||||
last_exported_main[i] = to_export_main;
|
last_exported_main[i] = to_export_main;
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
++exported_lines_count;
|
++exported_lines_count;
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
#else
|
#else
|
||||||
float elapsed_time = it->elapsed_time;
|
float elapsed_time = it->elapsed_time;
|
||||||
std::pair<int, int> to_export = { int(100.0f * elapsed_time / machine.time),
|
std::pair<int, int> to_export = { int(100.0f * elapsed_time / machine.time),
|
||||||
|
@ -577,9 +557,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename)
|
||||||
export_line += format_line_M73(machine.line_m73_mask.c_str(),
|
export_line += format_line_M73(machine.line_m73_mask.c_str(),
|
||||||
to_export.first, to_export.second);
|
to_export.first, to_export.second);
|
||||||
last_exported[i] = to_export;
|
last_exported[i] = to_export;
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
++exported_lines_count;
|
++exported_lines_count;
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
#endif // ENABLE_EXTENDED_M73_LINES
|
#endif // ENABLE_EXTENDED_M73_LINES
|
||||||
}
|
}
|
||||||
#if ENABLE_EXTENDED_M73_LINES
|
#if ENABLE_EXTENDED_M73_LINES
|
||||||
|
@ -593,9 +571,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename)
|
||||||
if (last_exported_stop[i] != to_export_stop) {
|
if (last_exported_stop[i] != to_export_stop) {
|
||||||
export_line += format_line_M73_stop_int(machine.line_m73_stop_mask.c_str(), to_export_stop);
|
export_line += format_line_M73_stop_int(machine.line_m73_stop_mask.c_str(), to_export_stop);
|
||||||
last_exported_stop[i] = to_export_stop;
|
last_exported_stop[i] = to_export_stop;
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
++exported_lines_count;
|
++exported_lines_count;
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -620,9 +596,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename)
|
||||||
export_line += format_line_M73_stop_float(machine.line_m73_stop_mask.c_str(), time_in_last_minute(it_stop->elapsed_time - it->elapsed_time));
|
export_line += format_line_M73_stop_float(machine.line_m73_stop_mask.c_str(), time_in_last_minute(it_stop->elapsed_time - it->elapsed_time));
|
||||||
|
|
||||||
last_exported_stop[i] = to_export_stop;
|
last_exported_stop[i] = to_export_stop;
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
++exported_lines_count;
|
++exported_lines_count;
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -632,9 +606,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
return exported_lines_count;
|
return exported_lines_count;
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// helper function to write to disk
|
// helper function to write to disk
|
||||||
|
@ -649,10 +621,8 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename)
|
||||||
export_line.clear();
|
export_line.clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
unsigned int line_id = 0;
|
unsigned int line_id = 0;
|
||||||
std::vector<std::pair<unsigned int, unsigned int>> offsets;
|
std::vector<std::pair<unsigned int, unsigned int>> offsets;
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
|
|
||||||
while (std::getline(in, gcode_line)) {
|
while (std::getline(in, gcode_line)) {
|
||||||
if (!in.good()) {
|
if (!in.good()) {
|
||||||
|
@ -660,19 +630,13 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename)
|
||||||
throw Slic3r::RuntimeError(std::string("Time estimator post process export failed.\nError while reading from file.\n"));
|
throw Slic3r::RuntimeError(std::string("Time estimator post process export failed.\nError while reading from file.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
++line_id;
|
++line_id;
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
|
|
||||||
gcode_line += "\n";
|
gcode_line += "\n";
|
||||||
// replace placeholder lines
|
// replace placeholder lines
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
auto [processed, result, lines_added_count] = process_placeholders(gcode_line);
|
auto [processed, result, lines_added_count] = process_placeholders(gcode_line);
|
||||||
if (processed && lines_added_count > 0)
|
if (processed && lines_added_count > 0)
|
||||||
offsets.push_back({ line_id, lines_added_count });
|
offsets.push_back({ line_id, lines_added_count });
|
||||||
#else
|
|
||||||
auto [processed, result] = process_placeholders(gcode_line);
|
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
gcode_line = result;
|
gcode_line = result;
|
||||||
if (!processed) {
|
if (!processed) {
|
||||||
// remove temporary lines
|
// remove temporary lines
|
||||||
|
@ -683,15 +647,10 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename)
|
||||||
parser.parse_line(gcode_line,
|
parser.parse_line(gcode_line,
|
||||||
[&](GCodeReader& reader, const GCodeReader::GCodeLine& line) {
|
[&](GCodeReader& reader, const GCodeReader::GCodeLine& line) {
|
||||||
if (line.cmd_is("G1")) {
|
if (line.cmd_is("G1")) {
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
unsigned int extra_lines_count = process_line_G1();
|
unsigned int extra_lines_count = process_line_G1();
|
||||||
++g1_lines_counter;
|
++g1_lines_counter;
|
||||||
if (extra_lines_count > 0)
|
if (extra_lines_count > 0)
|
||||||
offsets.push_back({ line_id, extra_lines_count });
|
offsets.push_back({ line_id, extra_lines_count });
|
||||||
#else
|
|
||||||
process_line_G1();
|
|
||||||
++g1_lines_counter;
|
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -707,7 +666,6 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename)
|
||||||
fclose(out);
|
fclose(out);
|
||||||
in.close();
|
in.close();
|
||||||
|
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
// updates moves' gcode ids which have been modified by the insertion of the M73 lines
|
// updates moves' gcode ids which have been modified by the insertion of the M73 lines
|
||||||
unsigned int curr_offset_id = 0;
|
unsigned int curr_offset_id = 0;
|
||||||
unsigned int total_offset = 0;
|
unsigned int total_offset = 0;
|
||||||
|
@ -718,7 +676,6 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename)
|
||||||
}
|
}
|
||||||
move.gcode_id += total_offset;
|
move.gcode_id += total_offset;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
|
|
||||||
if (rename_file(out_path, filename))
|
if (rename_file(out_path, filename))
|
||||||
throw Slic3r::RuntimeError(std::string("Failed to rename the output G-code file from ") + out_path + " to " + filename + '\n' +
|
throw Slic3r::RuntimeError(std::string("Failed to rename the output G-code file from ") + out_path + " to " + filename + '\n' +
|
||||||
|
@ -1214,12 +1171,10 @@ void GCodeProcessor::reset()
|
||||||
m_cached_position.reset();
|
m_cached_position.reset();
|
||||||
m_wiping = false;
|
m_wiping = false;
|
||||||
|
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
m_line_id = 0;
|
m_line_id = 0;
|
||||||
#if ENABLE_SEAMS_VISUALIZATION
|
#if ENABLE_SEAMS_VISUALIZATION
|
||||||
m_last_line_id = 0;
|
m_last_line_id = 0;
|
||||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
m_feedrate = 0.0f;
|
m_feedrate = 0.0f;
|
||||||
m_width = 0.0f;
|
m_width = 0.0f;
|
||||||
m_height = 0.0f;
|
m_height = 0.0f;
|
||||||
|
@ -1349,11 +1304,7 @@ void GCodeProcessor::process_file(const std::string& filename, bool apply_postpr
|
||||||
|
|
||||||
// post-process to add M73 lines into the gcode
|
// post-process to add M73 lines into the gcode
|
||||||
if (apply_postprocess)
|
if (apply_postprocess)
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
m_time_processor.post_process(filename, m_result.moves);
|
m_time_processor.post_process(filename, m_result.moves);
|
||||||
#else
|
|
||||||
m_time_processor.post_process(filename);
|
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
std::cout << "\n";
|
std::cout << "\n";
|
||||||
|
@ -1500,9 +1451,7 @@ void GCodeProcessor::process_gcode_line(const GCodeReader::GCodeLine& line)
|
||||||
{
|
{
|
||||||
/* std::cout << line.raw() << std::endl; */
|
/* std::cout << line.raw() << std::endl; */
|
||||||
|
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
++m_line_id;
|
++m_line_id;
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
|
|
||||||
// update start position
|
// update start position
|
||||||
m_start_position = m_end_position;
|
m_start_position = m_end_position;
|
||||||
|
@ -3064,13 +3013,11 @@ void GCodeProcessor::store_move_vertex(EMoveType type)
|
||||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||||
|
|
||||||
MoveVertex vertex = {
|
MoveVertex vertex = {
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
#if ENABLE_SEAMS_VISUALIZATION
|
#if ENABLE_SEAMS_VISUALIZATION
|
||||||
m_last_line_id,
|
m_last_line_id,
|
||||||
#else
|
#else
|
||||||
(type == EMoveType::Color_change || type == EMoveType::Pause_Print || type == EMoveType::Custom_GCode) ? m_line_id + 1 : m_line_id,
|
(type == EMoveType::Color_change || type == EMoveType::Pause_Print || type == EMoveType::Custom_GCode) ? m_line_id + 1 : m_line_id,
|
||||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
type,
|
type,
|
||||||
m_extrusion_role,
|
m_extrusion_role,
|
||||||
m_extruder_id,
|
m_extruder_id,
|
||||||
|
|
|
@ -210,7 +210,6 @@ namespace Slic3r {
|
||||||
float time() const;
|
float time() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
struct MoveVertex
|
struct MoveVertex
|
||||||
{
|
{
|
||||||
unsigned int gcode_id{ 0 };
|
unsigned int gcode_id{ 0 };
|
||||||
|
@ -230,7 +229,6 @@ namespace Slic3r {
|
||||||
|
|
||||||
float volumetric_rate() const { return feedrate * mm3_per_mm; }
|
float volumetric_rate() const { return feedrate * mm3_per_mm; }
|
||||||
};
|
};
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct TimeMachine
|
struct TimeMachine
|
||||||
|
@ -326,12 +324,8 @@ namespace Slic3r {
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
// post process the file with the given filename to add remaining time lines M73
|
// post process the file with the given filename to add remaining time lines M73
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
// and updates moves' gcode ids accordingly
|
// and updates moves' gcode ids accordingly
|
||||||
void post_process(const std::string& filename, std::vector<MoveVertex>& moves);
|
void post_process(const std::string& filename, std::vector<MoveVertex>& moves);
|
||||||
#else
|
|
||||||
void post_process(const std::string& filename);
|
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UsedFilaments // filaments per ColorChange
|
struct UsedFilaments // filaments per ColorChange
|
||||||
|
@ -358,27 +352,6 @@ namespace Slic3r {
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#if !ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
struct MoveVertex
|
|
||||||
{
|
|
||||||
EMoveType type{ EMoveType::Noop };
|
|
||||||
ExtrusionRole extrusion_role{ erNone };
|
|
||||||
unsigned char extruder_id{ 0 };
|
|
||||||
unsigned char cp_color_id{ 0 };
|
|
||||||
Vec3f position{ Vec3f::Zero() }; // mm
|
|
||||||
float delta_extruder{ 0.0f }; // mm
|
|
||||||
float feedrate{ 0.0f }; // mm/s
|
|
||||||
float width{ 0.0f }; // mm
|
|
||||||
float height{ 0.0f }; // mm
|
|
||||||
float mm3_per_mm{ 0.0f };
|
|
||||||
float fan_speed{ 0.0f }; // percentage
|
|
||||||
float temperature{ 0.0f }; // Celsius degrees
|
|
||||||
float time{ 0.0f }; // s
|
|
||||||
|
|
||||||
float volumetric_rate() const { return feedrate * mm3_per_mm; }
|
|
||||||
};
|
|
||||||
#endif // !ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
|
|
||||||
struct Result
|
struct Result
|
||||||
{
|
{
|
||||||
struct SettingsIds
|
struct SettingsIds
|
||||||
|
@ -518,12 +491,10 @@ namespace Slic3r {
|
||||||
CachedPosition m_cached_position;
|
CachedPosition m_cached_position;
|
||||||
bool m_wiping;
|
bool m_wiping;
|
||||||
|
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
unsigned int m_line_id;
|
unsigned int m_line_id;
|
||||||
#if ENABLE_SEAMS_VISUALIZATION
|
#if ENABLE_SEAMS_VISUALIZATION
|
||||||
unsigned int m_last_line_id;
|
unsigned int m_last_line_id;
|
||||||
#endif // ENABLE_SEAMS_VISUALIZATION
|
#endif // ENABLE_SEAMS_VISUALIZATION
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
float m_feedrate; // mm/s
|
float m_feedrate; // mm/s
|
||||||
float m_width; // mm
|
float m_width; // mm
|
||||||
float m_height; // mm
|
float m_height; // mm
|
||||||
|
|
|
@ -41,8 +41,6 @@
|
||||||
//====================
|
//====================
|
||||||
#define ENABLE_2_4_0_ALPHA0 1
|
#define ENABLE_2_4_0_ALPHA0 1
|
||||||
|
|
||||||
// Enable showing gcode line numbers in preview horizontal slider
|
|
||||||
#define ENABLE_GCODE_LINES_ID_IN_H_SLIDER (1 && ENABLE_2_4_0_ALPHA0)
|
|
||||||
// Enable validation of custom gcode against gcode processor reserved keywords
|
// Enable validation of custom gcode against gcode processor reserved keywords
|
||||||
#define ENABLE_VALIDATE_CUSTOM_GCODE (1 && ENABLE_2_4_0_ALPHA0)
|
#define ENABLE_VALIDATE_CUSTOM_GCODE (1 && ENABLE_2_4_0_ALPHA0)
|
||||||
// Enable showing a imgui window containing gcode in preview
|
// Enable showing a imgui window containing gcode in preview
|
||||||
|
|
|
@ -739,16 +739,11 @@ wxString Control::get_label(int tick, LabelType label_type/* = ltHeightWithLayer
|
||||||
return size_t(it - m_layers_values.begin());
|
return size_t(it - m_layers_values.begin());
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
if (m_draw_mode == dmSequentialGCodeView) {
|
if (m_draw_mode == dmSequentialGCodeView) {
|
||||||
return (Slic3r::GUI::get_app_config()->get("seq_top_gcode_indices") == "1") ?
|
return (Slic3r::GUI::get_app_config()->get("seq_top_gcode_indices") == "1") ?
|
||||||
wxString::Format("%lu", static_cast<unsigned long>(m_alternate_values[value])) :
|
wxString::Format("%lu", static_cast<unsigned long>(m_alternate_values[value])) :
|
||||||
wxString::Format("%lu", static_cast<unsigned long>(m_values[value]));
|
wxString::Format("%lu", static_cast<unsigned long>(m_values[value]));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (m_draw_mode == dmSequentialGCodeView)
|
|
||||||
return wxString::Format("%lu", static_cast<unsigned long>(m_values[value]));
|
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
else {
|
else {
|
||||||
if (label_type == ltEstimatedTime) {
|
if (label_type == ltEstimatedTime) {
|
||||||
if (m_is_wipe_tower) {
|
if (m_is_wipe_tower) {
|
||||||
|
|
|
@ -223,9 +223,7 @@ public:
|
||||||
void SetKoefForLabels(const double koef) { m_label_koef = koef; }
|
void SetKoefForLabels(const double koef) { m_label_koef = koef; }
|
||||||
void SetSliderValues(const std::vector<double>& values);
|
void SetSliderValues(const std::vector<double>& values);
|
||||||
void ChangeOneLayerLock();
|
void ChangeOneLayerLock();
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
void SetSliderAlternateValues(const std::vector<double>& values) { m_alternate_values = values; }
|
void SetSliderAlternateValues(const std::vector<double>& values) { m_alternate_values = values; }
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
|
|
||||||
Info GetTicksValues() const;
|
Info GetTicksValues() const;
|
||||||
void SetTicksValues(const Info &custom_gcode_per_print_z);
|
void SetTicksValues(const Info &custom_gcode_per_print_z);
|
||||||
|
@ -409,9 +407,7 @@ private:
|
||||||
std::vector<std::string> m_extruder_colors;
|
std::vector<std::string> m_extruder_colors;
|
||||||
std::string m_print_obj_idxs;
|
std::string m_print_obj_idxs;
|
||||||
|
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
std::vector<double> m_alternate_values;
|
std::vector<double> m_alternate_values;
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
|
|
||||||
// control's view variables
|
// control's view variables
|
||||||
wxCoord SLIDER_MARGIN; // margin around slider
|
wxCoord SLIDER_MARGIN; // margin around slider
|
||||||
|
|
|
@ -1443,12 +1443,10 @@ void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result)
|
||||||
m_max_bounding_box = m_paths_bounding_box;
|
m_max_bounding_box = m_paths_bounding_box;
|
||||||
m_max_bounding_box.merge(m_paths_bounding_box.max + m_sequential_view.marker.get_bounding_box().size()[2] * Vec3d::UnitZ());
|
m_max_bounding_box.merge(m_paths_bounding_box.max + m_sequential_view.marker.get_bounding_box().size()[2] * Vec3d::UnitZ());
|
||||||
|
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
m_sequential_view.gcode_ids.clear();
|
m_sequential_view.gcode_ids.clear();
|
||||||
for (const GCodeProcessor::MoveVertex& move : gcode_result.moves) {
|
for (const GCodeProcessor::MoveVertex& move : gcode_result.moves) {
|
||||||
m_sequential_view.gcode_ids.push_back(move.gcode_id);
|
m_sequential_view.gcode_ids.push_back(move.gcode_id);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
|
|
||||||
std::vector<MultiVertexBuffer> vertices(m_buffers.size());
|
std::vector<MultiVertexBuffer> vertices(m_buffers.size());
|
||||||
std::vector<MultiIndexBuffer> indices(m_buffers.size());
|
std::vector<MultiIndexBuffer> indices(m_buffers.size());
|
||||||
|
|
|
@ -574,9 +574,7 @@ public:
|
||||||
#if ENABLE_GCODE_WINDOW
|
#if ENABLE_GCODE_WINDOW
|
||||||
GCodeWindow gcode_window;
|
GCodeWindow gcode_window;
|
||||||
#endif // ENABLE_GCODE_WINDOW
|
#endif // ENABLE_GCODE_WINDOW
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
std::vector<unsigned int> gcode_ids;
|
std::vector<unsigned int> gcode_ids;
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
|
|
||||||
#if ENABLE_GCODE_WINDOW
|
#if ENABLE_GCODE_WINDOW
|
||||||
void render(float legend_height) const;
|
void render(float legend_height) const;
|
||||||
|
|
|
@ -1908,11 +1908,7 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
|
||||||
PreferencesDialog dlg(mainframe);
|
PreferencesDialog dlg(mainframe);
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
app_layout_changed = dlg.settings_layout_changed();
|
app_layout_changed = dlg.settings_layout_changed();
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
if (dlg.seq_top_layer_only_changed() || dlg.seq_seq_top_gcode_indices_changed())
|
if (dlg.seq_top_layer_only_changed() || dlg.seq_seq_top_gcode_indices_changed())
|
||||||
#else
|
|
||||||
if (dlg.seq_top_layer_only_changed())
|
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
this->plater_->refresh_print();
|
this->plater_->refresh_print();
|
||||||
|
|
||||||
if (dlg.recreate_GUI()) {
|
if (dlg.recreate_GUI()) {
|
||||||
|
|
|
@ -834,25 +834,17 @@ void Preview::update_moves_slider()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::vector<double> values(view.endpoints.last - view.endpoints.first + 1);
|
std::vector<double> values(view.endpoints.last - view.endpoints.first + 1);
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
std::vector<double> alternate_values(view.endpoints.last - view.endpoints.first + 1);
|
std::vector<double> alternate_values(view.endpoints.last - view.endpoints.first + 1);
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
for (unsigned int i = view.endpoints.first; i <= view.endpoints.last; ++i) {
|
for (unsigned int i = view.endpoints.first; i <= view.endpoints.last; ++i) {
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
values[count] = static_cast<double>(i + 1);
|
values[count] = static_cast<double>(i + 1);
|
||||||
if (view.gcode_ids[i] > 0)
|
if (view.gcode_ids[i] > 0)
|
||||||
alternate_values[count] = static_cast<double>(view.gcode_ids[i]);
|
alternate_values[count] = static_cast<double>(view.gcode_ids[i]);
|
||||||
++count;
|
++count;
|
||||||
#else
|
|
||||||
values[count++] = static_cast<double>(i + 1);
|
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_moves_slider->SetSliderValues(values);
|
m_moves_slider->SetSliderValues(values);
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
m_moves_slider->SetSliderAlternateValues(alternate_values);
|
m_moves_slider->SetSliderAlternateValues(alternate_values);
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
m_moves_slider->SetMaxValue(view.endpoints.last - view.endpoints.first);
|
m_moves_slider->SetMaxValue(view.endpoints.last - view.endpoints.first);
|
||||||
m_moves_slider->SetSelectionSpan(view.current.first - view.endpoints.first, view.current.last - view.endpoints.first);
|
m_moves_slider->SetSelectionSpan(view.current.first - view.endpoints.first, view.current.last - view.endpoints.first);
|
||||||
}
|
}
|
||||||
|
|
|
@ -292,7 +292,6 @@ void PreferencesDialog::build()
|
||||||
option = Option(def, "seq_top_layer_only");
|
option = Option(def, "seq_top_layer_only");
|
||||||
m_optgroup_gui->append_single_option_line(option);
|
m_optgroup_gui->append_single_option_line(option);
|
||||||
|
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
def.label = L("Sequential slider shows gcode line numbers");
|
def.label = L("Sequential slider shows gcode line numbers");
|
||||||
def.type = coBool;
|
def.type = coBool;
|
||||||
def.tooltip = L("If enabled, the sequential slider, in preview, shows the gcode lines numbers."
|
def.tooltip = L("If enabled, the sequential slider, in preview, shows the gcode lines numbers."
|
||||||
|
@ -300,7 +299,6 @@ void PreferencesDialog::build()
|
||||||
def.set_default_value(new ConfigOptionBool{ app_config->get("seq_top_gcode_indices") == "1" });
|
def.set_default_value(new ConfigOptionBool{ app_config->get("seq_top_gcode_indices") == "1" });
|
||||||
option = Option(def, "seq_top_gcode_indices");
|
option = Option(def, "seq_top_gcode_indices");
|
||||||
m_optgroup_gui->append_single_option_line(option);
|
m_optgroup_gui->append_single_option_line(option);
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
|
|
||||||
if (is_editor) {
|
if (is_editor) {
|
||||||
def.label = L("Show sidebar collapse/expand button");
|
def.label = L("Show sidebar collapse/expand button");
|
||||||
|
@ -438,11 +436,9 @@ void PreferencesDialog::accept(wxEvent&)
|
||||||
if (auto it = m_values.find("seq_top_layer_only"); it != m_values.end())
|
if (auto it = m_values.find("seq_top_layer_only"); it != m_values.end())
|
||||||
m_seq_top_layer_only_changed = app_config->get("seq_top_layer_only") != it->second;
|
m_seq_top_layer_only_changed = app_config->get("seq_top_layer_only") != it->second;
|
||||||
|
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
m_seq_top_gcode_indices_changed = false;
|
m_seq_top_gcode_indices_changed = false;
|
||||||
if (auto it = m_values.find("seq_top_gcode_indices"); it != m_values.end())
|
if (auto it = m_values.find("seq_top_gcode_indices"); it != m_values.end())
|
||||||
m_seq_top_gcode_indices_changed = app_config->get("seq_top_gcode_indices") != it->second;
|
m_seq_top_gcode_indices_changed = app_config->get("seq_top_gcode_indices") != it->second;
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
|
|
||||||
m_settings_layout_changed = false;
|
m_settings_layout_changed = false;
|
||||||
for (const std::string& key : { "old_settings_layout_mode",
|
for (const std::string& key : { "old_settings_layout_mode",
|
||||||
|
|
|
@ -29,9 +29,7 @@ class PreferencesDialog : public DPIDialog
|
||||||
bool isOSX {false};
|
bool isOSX {false};
|
||||||
bool m_settings_layout_changed {false};
|
bool m_settings_layout_changed {false};
|
||||||
bool m_seq_top_layer_only_changed{ false };
|
bool m_seq_top_layer_only_changed{ false };
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
bool m_seq_top_gcode_indices_changed{ false };
|
bool m_seq_top_gcode_indices_changed{ false };
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
bool m_recreate_GUI{false};
|
bool m_recreate_GUI{false};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -40,9 +38,7 @@ public:
|
||||||
|
|
||||||
bool settings_layout_changed() const { return m_settings_layout_changed; }
|
bool settings_layout_changed() const { return m_settings_layout_changed; }
|
||||||
bool seq_top_layer_only_changed() const { return m_seq_top_layer_only_changed; }
|
bool seq_top_layer_only_changed() const { return m_seq_top_layer_only_changed; }
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
bool seq_seq_top_gcode_indices_changed() const { return m_seq_top_gcode_indices_changed; }
|
bool seq_seq_top_gcode_indices_changed() const { return m_seq_top_gcode_indices_changed; }
|
||||||
#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
|
||||||
bool recreate_GUI() const { return m_recreate_GUI; }
|
bool recreate_GUI() const { return m_recreate_GUI; }
|
||||||
void build();
|
void build();
|
||||||
void accept(wxEvent&);
|
void accept(wxEvent&);
|
||||||
|
|
Loading…
Reference in a new issue