mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 10:17:55 -06:00
Merge branch 'merge-upstream'
Signed-off-by: SoftFever <softfeverever@gmail.com> # Conflicts: # src/libslic3r/Preset.cpp # src/libslic3r/PrintConfig.cpp # src/libslic3r/PrintConfig.hpp
This commit is contained in:
commit
59bab91da9
579 changed files with 23269 additions and 11097 deletions
|
@ -59,7 +59,8 @@ const std::vector<std::string> GCodeProcessor::Reserved_Tags = {
|
|||
"_GP_FIRST_LINE_M73_PLACEHOLDER",
|
||||
"_GP_LAST_LINE_M73_PLACEHOLDER",
|
||||
"_GP_ESTIMATED_PRINTING_TIME_PLACEHOLDER",
|
||||
"_GP_TOTAL_LAYER_NUMBER_PLACEHOLDER"
|
||||
"_GP_TOTAL_LAYER_NUMBER_PLACEHOLDER",
|
||||
"_DURING_PRINT_EXHAUST_FAN"
|
||||
};
|
||||
|
||||
const std::vector<std::string> GCodeProcessor::Reserved_Tags_compatible = {
|
||||
|
@ -383,6 +384,8 @@ void GCodeProcessor::TimeProcessor::reset()
|
|||
machine_limits = MachineEnvelopeConfig();
|
||||
filament_load_times = 0.0f;
|
||||
filament_unload_times = 0.0f;
|
||||
|
||||
|
||||
for (size_t i = 0; i < static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count); ++i) {
|
||||
machines[i].reset();
|
||||
}
|
||||
|
@ -427,6 +430,14 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
|
|||
return std::string(line_M73);
|
||||
};
|
||||
|
||||
auto format_line_exhaust_fan_control = [](const std::string& mask,int fan_index,int percent) {
|
||||
char line_fan[64] = { 0 };
|
||||
sprintf(line_fan,mask.c_str(),
|
||||
std::to_string(fan_index).c_str(),
|
||||
std::to_string(int((percent/100.0)*255)).c_str());
|
||||
return std::string(line_fan);
|
||||
};
|
||||
|
||||
auto format_time_float = [](float time) {
|
||||
return Slic3r::float_to_string_decimal_point(time, 2);
|
||||
};
|
||||
|
@ -542,7 +553,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
|
|||
// add lines M73 to exported gcode
|
||||
auto process_line_move = [
|
||||
// Lambdas, mostly for string formatting, all with an empty capture block.
|
||||
time_in_minutes, format_time_float, format_line_M73_main, format_line_M73_stop_int, format_line_M73_stop_float, time_in_last_minute,
|
||||
time_in_minutes, format_time_float, format_line_M73_main, format_line_M73_stop_int, format_line_M73_stop_float, time_in_last_minute,format_line_exhaust_fan_control,
|
||||
&self = std::as_const(*this),
|
||||
// Caches, to be modified
|
||||
&g1_times_cache_it, &last_exported_main, &last_exported_stop,
|
||||
|
@ -561,6 +572,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
|
|||
if (it != machine.g1_times_cache.end() && it->id == g1_lines_counter) {
|
||||
std::pair<int, int> to_export_main = { int(100.0f * it->elapsed_time / machine.time),
|
||||
time_in_minutes(machine.time - it->elapsed_time) };
|
||||
|
||||
if (last_exported_main[i] != to_export_main) {
|
||||
export_line += format_line_M73_main(machine.line_m73_main_mask.c_str(),
|
||||
to_export_main.first, to_export_main.second);
|
||||
|
@ -802,6 +814,7 @@ void GCodeProcessorResult::reset() {
|
|||
toolpath_outside = false;
|
||||
//BBS: add label_object_enabled
|
||||
label_object_enabled = false;
|
||||
timelapse_warning_code = 0;
|
||||
printable_height = 0.0f;
|
||||
settings_ids.reset();
|
||||
extruders_count = 0;
|
||||
|
@ -829,6 +842,7 @@ void GCodeProcessorResult::reset() {
|
|||
toolpath_outside = false;
|
||||
//BBS: add label_object_enabled
|
||||
label_object_enabled = false;
|
||||
timelapse_warning_code = 0;
|
||||
printable_height = 0.0f;
|
||||
settings_ids.reset();
|
||||
extruders_count = 0;
|
||||
|
@ -998,6 +1012,8 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
|
|||
const ConfigOptionBool* spiral_vase = config.option<ConfigOptionBool>("spiral_mode");
|
||||
if (spiral_vase != nullptr)
|
||||
m_spiral_vase_active = spiral_vase->value;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
|
||||
|
@ -1498,9 +1514,9 @@ void GCodeProcessor::finalize(bool post_process)
|
|||
m_height_compare.output();
|
||||
m_width_compare.output();
|
||||
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||
|
||||
if (post_process)
|
||||
if (post_process){
|
||||
m_time_processor.post_process(m_result.filename, m_result.moves, m_result.lines_ends, m_layer_id);
|
||||
}
|
||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||
m_result.time = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - m_start_time).count();
|
||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||
|
@ -1817,6 +1833,7 @@ void GCodeProcessor::process_gcode_line(const GCodeReader::GCodeLine& line, bool
|
|||
case '9':
|
||||
switch (cmd[3]) {
|
||||
case '0': { process_M190(line); break; } // Wait bed temperature
|
||||
case '1': { process_M191(line); break; } // Wait chamber temperature
|
||||
default: break;
|
||||
}
|
||||
default:
|
||||
|
@ -1935,7 +1952,7 @@ template<typename T>
|
|||
// Legacy conversion, which is costly due to having to make a copy of the string before conversion.
|
||||
try {
|
||||
assert(sv.size() < 1024);
|
||||
assert(sv.data() != nullptr);
|
||||
assert(sv.data() != nullptr);
|
||||
std::string str { sv };
|
||||
size_t read = 0;
|
||||
if constexpr (std::is_same_v<T, int>)
|
||||
|
@ -3751,6 +3768,15 @@ void GCodeProcessor::process_M190(const GCodeReader::GCodeLine& line)
|
|||
m_highest_bed_temp = m_highest_bed_temp < (int)new_temp ? (int)new_temp : m_highest_bed_temp;
|
||||
}
|
||||
|
||||
void GCodeProcessor::process_M191(const GCodeReader::GCodeLine& line)
|
||||
{
|
||||
float chamber_temp = 0;
|
||||
const float wait_chamber_temp_time = 720.0;
|
||||
// BBS: when chamber_temp>40,caculate time required for heating
|
||||
if (line.has_value('S', chamber_temp) && chamber_temp > 40)
|
||||
simulate_st_synchronize(wait_chamber_temp_time);
|
||||
}
|
||||
|
||||
|
||||
void GCodeProcessor::process_M201(const GCodeReader::GCodeLine& line)
|
||||
{
|
||||
|
@ -4355,6 +4381,29 @@ void GCodeProcessor::update_slice_warnings()
|
|||
m_result.warnings.push_back(warning);
|
||||
}
|
||||
|
||||
// bbs:HRC checker
|
||||
warning.params.clear();
|
||||
warning.level = 1;
|
||||
if (!m_result.support_traditional_timelapse) {
|
||||
warning.msg = NOT_SUPPORT_TRADITIONAL_TIMELAPSE;
|
||||
warning.error_code = "1000C003";
|
||||
m_result.warnings.push_back(warning);
|
||||
}
|
||||
|
||||
if (m_result.timelapse_warning_code != 0) {
|
||||
if (m_result.timelapse_warning_code & 1) {
|
||||
warning.msg = NOT_GENERATE_TIMELAPSE;
|
||||
warning.error_code = "1001C001";
|
||||
m_result.warnings.push_back(warning);
|
||||
}
|
||||
|
||||
if ((m_result.timelapse_warning_code >> 1) & 1) {
|
||||
warning.msg = NOT_GENERATE_TIMELAPSE;
|
||||
warning.error_code = "1001C002";
|
||||
m_result.warnings.push_back(warning);
|
||||
}
|
||||
}
|
||||
|
||||
m_result.warnings.shrink_to_fit();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ namespace Slic3r {
|
|||
// slice warnings enum strings
|
||||
#define NOZZLE_HRC_CHECKER "the_actual_nozzle_hrc_smaller_than_the_required_nozzle_hrc"
|
||||
#define BED_TEMP_TOO_HIGH_THAN_FILAMENT "bed_temperature_too_high_than_filament"
|
||||
#define NOT_SUPPORT_TRADITIONAL_TIMELAPSE "not_support_traditional_timelapse"
|
||||
#define NOT_GENERATE_TIMELAPSE "not_generate_timelapse"
|
||||
|
||||
enum class EMoveType : unsigned char
|
||||
{
|
||||
|
@ -179,6 +181,8 @@ namespace Slic3r {
|
|||
bool toolpath_outside;
|
||||
//BBS: add object_label_enabled
|
||||
bool label_object_enabled;
|
||||
int timelapse_warning_code {0};
|
||||
bool support_traditional_timelapse{true};
|
||||
float printable_height;
|
||||
SettingsIds settings_ids;
|
||||
size_t extruders_count;
|
||||
|
@ -212,6 +216,7 @@ namespace Slic3r {
|
|||
bed_exclude_area = other.bed_exclude_area;
|
||||
toolpath_outside = other.toolpath_outside;
|
||||
label_object_enabled = other.label_object_enabled;
|
||||
timelapse_warning_code = other.timelapse_warning_code;
|
||||
printable_height = other.printable_height;
|
||||
settings_ids = other.settings_ids;
|
||||
extruders_count = other.extruders_count;
|
||||
|
@ -255,7 +260,8 @@ namespace Slic3r {
|
|||
First_Line_M73_Placeholder,
|
||||
Last_Line_M73_Placeholder,
|
||||
Estimated_Printing_Time_Placeholder,
|
||||
Total_Layer_Number_Placeholder
|
||||
Total_Layer_Number_Placeholder,
|
||||
During_Print_Exhaust_Fan
|
||||
};
|
||||
|
||||
static const std::string& reserved_tag(ETags tag) { return s_IsBBLPrinter ? Reserved_Tags[static_cast<unsigned char>(tag)] : Reserved_Tags_compatible[static_cast<unsigned char>(tag)]; }
|
||||
|
@ -357,6 +363,7 @@ namespace Slic3r {
|
|||
float time() const;
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
struct TimeMachine
|
||||
{
|
||||
|
@ -452,6 +459,7 @@ namespace Slic3r {
|
|||
// Additional load / unload times for a filament exchange sequence.
|
||||
float filament_load_times;
|
||||
float filament_unload_times;
|
||||
|
||||
std::array<TimeMachine, static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count)> machines;
|
||||
|
||||
void reset();
|
||||
|
@ -617,7 +625,6 @@ namespace Slic3r {
|
|||
|
||||
private:
|
||||
GCodeReader m_parser;
|
||||
|
||||
EUnits m_units;
|
||||
EPositioningType m_global_positioning_type;
|
||||
EPositioningType m_e_local_positioning_type;
|
||||
|
@ -711,6 +718,7 @@ namespace Slic3r {
|
|||
void reset();
|
||||
|
||||
const GCodeProcessorResult& get_result() const { return m_result; }
|
||||
GCodeProcessorResult& result() { return m_result; }
|
||||
GCodeProcessorResult&& extract_result() { return std::move(m_result); }
|
||||
|
||||
// Load a G-code into a stand-alone G-code viewer.
|
||||
|
@ -829,6 +837,9 @@ namespace Slic3r {
|
|||
//BBS: wait bed temperature
|
||||
void process_M190(const GCodeReader::GCodeLine& line);
|
||||
|
||||
//BBS: wait chamber temperature
|
||||
void process_M191(const GCodeReader::GCodeLine& line);
|
||||
|
||||
// Set max printing acceleration
|
||||
void process_M201(const GCodeReader::GCodeLine& line);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue