Merge remote-tracking branch 'origin/master' into lh_avoid_crossing_perimeters

This commit is contained in:
Lukáš Hejl 2020-12-01 14:31:22 +01:00
commit f25e5c0ec6
23 changed files with 13175 additions and 97 deletions

View file

@ -273,6 +273,7 @@ namespace Slic3r {
// Otherwise, leave control to the user completely.
std::string toolchange_gcode_str;
const std::string& toolchange_gcode = gcodegen.config().toolchange_gcode.value;
// m_max_layer_z = std::max(m_max_layer_z, tcr.print_z);
if (! toolchange_gcode.empty()) {
DynamicConfig config;
int previous_extruder_id = gcodegen.writer().extruder() ? (int)gcodegen.writer().extruder()->id() : -1;
@ -280,6 +281,7 @@ namespace Slic3r {
config.set_key_value("next_extruder", new ConfigOptionInt((int)new_extruder_id));
config.set_key_value("layer_num", new ConfigOptionInt(gcodegen.m_layer_index));
config.set_key_value("layer_z", new ConfigOptionFloat(tcr.print_z));
// config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z));
toolchange_gcode_str = gcodegen.placeholder_parser_process("toolchange_gcode", toolchange_gcode, new_extruder_id, &config);
check_add_eol(toolchange_gcode_str);
}
@ -924,11 +926,12 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
DoExport::init_gcode_processor(print.config(), m_processor, m_silent_time_estimator_enabled);
// resets analyzer's tracking data
m_last_height = 0.0f;
m_last_layer_z = 0.0f;
m_last_height = 0.f;
m_last_layer_z = 0.f;
m_max_layer_z = 0.f;
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
m_last_mm3_per_mm = 0.0;
m_last_width = 0.0f;
m_last_mm3_per_mm = 0.;
m_last_width = 0.f;
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
// How many times will be change_layer() called?
@ -1282,6 +1285,7 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
DynamicConfig config;
config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index));
config.set_key_value("layer_z", new ConfigOptionFloat(m_writer.get_position()(2) - m_config.z_offset.value));
config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z));
if (print.config().single_extruder_multi_material) {
// Process the end_filament_gcode for the active filament only.
int extruder_id = m_writer.extruder()->id();
@ -1783,13 +1787,15 @@ void GCode::process_layer(
gcode += buf;
// update caches
m_last_layer_z = static_cast<float>(print_z);
m_max_layer_z = std::max(m_max_layer_z, m_last_layer_z);
m_last_height = height;
// Set new layer - this will change Z and force a retraction if retract_layer_change is enabled.
if (! print.config().before_layer_gcode.value.empty()) {
DynamicConfig config;
config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index + 1));
config.set_key_value("layer_z", new ConfigOptionFloat(print_z));
config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index + 1));
config.set_key_value("layer_z", new ConfigOptionFloat(print_z));
config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z));
gcode += this->placeholder_parser_process("before_layer_gcode",
print.config().before_layer_gcode.value, m_writer.extruder()->id(), &config)
+ "\n";
@ -1803,6 +1809,7 @@ void GCode::process_layer(
gcode += this->placeholder_parser_process("layer_gcode",
print.config().layer_gcode.value, m_writer.extruder()->id(), &config)
+ "\n";
config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z));
}
if (! first_layer && ! m_second_layer_things_done) {
@ -2811,6 +2818,7 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z)
config.set_key_value("next_extruder", new ConfigOptionInt((int)extruder_id));
config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index));
config.set_key_value("layer_z", new ConfigOptionFloat(print_z));
config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z));
toolchange_gcode_parsed = placeholder_parser_process("toolchange_gcode", toolchange_gcode, extruder_id, &config);
gcode += toolchange_gcode_parsed;
check_add_eol(gcode);

View file

@ -323,6 +323,7 @@ private:
// Support for G-Code Processor
float m_last_height{ 0.0f };
float m_last_layer_z{ 0.0f };
float m_max_layer_z{ 0.0f };
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
double m_last_mm3_per_mm;
float m_last_width{ 0.0f };

View file

@ -266,8 +266,9 @@ inline bool liang_barsky_line_clipping(
// Clipped successfully.
x1 = x0 + interval.second * v;
x0 += interval.first * v;
return true;
}
return true;
return false;
}
// Based on Liang-Barsky function by Daniel White @ http://www.skytopia.com/project/articles/compsci/clipping.html

View file

@ -159,8 +159,8 @@ void PrintConfigDef::init_common_params()
def->enum_keys_map = &ConfigOptionEnum<AuthorizationType>::get_enum_values();
def->enum_values.push_back("key");
def->enum_values.push_back("user");
def->enum_labels.push_back("KeyPassword");
def->enum_labels.push_back("UserPassword");
def->enum_labels.push_back("API key");
def->enum_labels.push_back("HTTP digest");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<AuthorizationType>(atKeyPassword));
}

View file

@ -83,4 +83,12 @@
#define ENABLE_CUSTOMIZABLE_FILES_ASSOCIATION_ON_WIN (1 && ENABLE_2_3_0_BETA1)
//===================
// 2.3.0.beta2 techs
//===================
#define ENABLE_2_3_0_BETA2 1
#define ENABLE_ARROW_KEYS_WITH_SLIDERS (1 && ENABLE_2_3_0_BETA2)
#endif // _prusaslicer_technologies_h_

View file

@ -552,6 +552,7 @@ std::string encode_path(const char *src)
}
// Encode an 8-bit string from a local code page to UTF-8.
// Multibyte to utf8
std::string decode_path(const char *src)
{
#ifdef WIN32