Merge remote-tracking branch 'remote/master' into feature/merge_upstream

# Conflicts:
#	bbl/i18n/OrcaSlicer.pot
#	bbl/i18n/de/OrcaSlicer_de.po
#	bbl/i18n/en/OrcaSlicer_en.po
#	bbl/i18n/es/OrcaSlicer_es.po
#	bbl/i18n/fr/OrcaSlicer_fr.po
#	bbl/i18n/hu/OrcaSlicer_hu.po
#	bbl/i18n/it/OrcaSlicer_it.po
#	bbl/i18n/ja/OrcaSlicer_ja.po
#	bbl/i18n/nl/OrcaSlicer_nl.po
#	bbl/i18n/sv/OrcaSlicer_sv.po
#	bbl/i18n/zh_cn/OrcaSlicer_zh_CN.po
#	resources/config.json
#	resources/i18n/de/BambuStudio.mo
#	resources/i18n/en/BambuStudio.mo
#	resources/i18n/es/BambuStudio.mo
#	resources/i18n/fr/BambuStudio.mo
#	resources/i18n/hu/BambuStudio.mo
#	resources/i18n/it/BambuStudio.mo
#	resources/i18n/ja/OrcaSlicer.mo
#	resources/i18n/nl/BambuStudio.mo
#	resources/i18n/sv/BambuStudio.mo
#	resources/i18n/zh_cn/BambuStudio.mo
#	resources/images/ams_humidity_2.svg
#	resources/images/ams_humidity_3.svg
#	resources/images/ams_humidity_4.svg
#	resources/images/ams_humidity_tips.svg
#	resources/images/monitor_state_on.svg
#	resources/images/sdcard_state_normal.svg
#	resources/profiles/BBL.json
#	resources/profiles/BBL/filament/Bambu PETG-CF @base.json
#	resources/profiles/BBL/filament/Generic PETG-CF @base.json
#	resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json
#	resources/web/data/text.js
#	resources/web/guide/3/index.html
#	resources/web/guide/31/index.html
#	src/BambuStudio.cpp
#	src/libslic3r/AABBTreeLines.hpp
#	src/libslic3r/Brim.cpp
#	src/libslic3r/CMakeLists.txt
#	src/libslic3r/ExPolygon.hpp
#	src/libslic3r/Fill/FillBase.hpp
#	src/libslic3r/Format/bbs_3mf.cpp
#	src/libslic3r/GCodeWriter.cpp
#	src/libslic3r/Line.hpp
#	src/libslic3r/PerimeterGenerator.cpp
#	src/libslic3r/Preset.cpp
#	src/libslic3r/Print.cpp
#	src/libslic3r/Print.hpp
#	src/libslic3r/PrintConfig.cpp
#	src/libslic3r/PrintConfig.hpp
#	src/libslic3r/TreeSupport.cpp
#	src/slic3r/GUI/AmsMappingPopup.cpp
#	src/slic3r/GUI/BackgroundSlicingProcess.cpp
#	src/slic3r/GUI/ConfigManipulation.cpp
#	src/slic3r/GUI/GCodeViewer.cpp
#	src/slic3r/GUI/GCodeViewer.hpp
#	src/slic3r/GUI/GLCanvas3D.cpp
#	src/slic3r/GUI/GUI_App.cpp
#	src/slic3r/GUI/MainFrame.cpp
#	src/slic3r/GUI/PartPlate.cpp
#	src/slic3r/GUI/Plater.cpp
#	src/slic3r/GUI/Preferences.cpp
#	src/slic3r/GUI/SelectMachine.cpp
#	src/slic3r/GUI/Widgets/AMSControl.cpp
#	src/slic3r/GUI/wxMediaCtrl2.cpp
#	src/slic3r/Utils/Process.cpp
#	version.inc
This commit is contained in:
SoftFever 2023-04-19 08:48:07 +08:00
commit 9f598046d1
658 changed files with 70312 additions and 4877 deletions

View file

@ -529,9 +529,20 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
// retract before toolchange
toolchange_gcode_str = toolchange_retract_str + toolchange_gcode_str;
//BBS: current position and fan_speed is unclear after interting change_filament_gcode
toolchange_gcode_str += ";_FORCE_RESUME_FAN_SPEED\n";
gcodegen.writer().set_current_position_clear(false);
//BBS
{
//BBS: current position and fan_speed is unclear after interting change_filament_gcode
check_add_eol(toolchange_gcode_str);
toolchange_gcode_str += ";_FORCE_RESUME_FAN_SPEED\n";
gcodegen.writer().set_current_position_clear(false);
//BBS: check whether custom gcode changes the z position. Update if changed
double temp_z_after_tool_change;
if (GCodeProcessor::get_last_z_from_gcode(toolchange_gcode_str, temp_z_after_tool_change)) {
Vec3d pos = gcodegen.writer().get_position();
pos(2) = temp_z_after_tool_change;
gcodegen.writer().set_position(pos);
}
}
// move to start_pos for wiping after toolchange
std::string start_pos_str;
@ -1791,6 +1802,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
//BBS: gcode writer doesn't know where the real position of extruder is after inserting custom gcode
m_writer.set_current_position_clear(false);
m_start_gcode_filament = GCodeProcessor::get_gcode_last_filament(machine_start_gcode);
// Process filament-specific gcode.
/* if (has_wipe_tower) {
@ -4371,11 +4383,13 @@ bool GCode::needs_retraction(const Polyline &travel, ExtrusionRole role, LiftTyp
if (role == erSupportMaterial || role == erSupportTransition) {
const SupportLayer* support_layer = dynamic_cast<const SupportLayer*>(m_layer);
//FIXME support_layer->support_islands.contains should use some search structure!
if (support_layer != NULL && support_layer->support_islands.contains(travel))
if (support_layer != NULL)
// skip retraction if this is a travel move inside a support material island
//FIXME not retracting over a long path may cause oozing, which in turn may result in missing material
// at the end of the extrusion path!
return false;
for (const ExPolygon& support_island : support_layer->support_islands)
if (support_island.contains(travel))
return false;
//reduce the retractions in lightning infills for tree support
if (support_layer != NULL && support_layer->support_type==stInnerTree)
for (auto &area : support_layer->base_areas)
@ -4384,7 +4398,7 @@ bool GCode::needs_retraction(const Polyline &travel, ExtrusionRole role, LiftTyp
}
//BBS: need retract when long moving to print perimeter to avoid dropping of material
if (!is_perimeter(role) && m_config.reduce_infill_retraction && m_layer != nullptr &&
m_config.sparse_infill_density.value > 0 && m_layer->any_internal_region_slice_contains(travel))
m_config.sparse_infill_density.value > 0 && m_retract_when_crossing_perimeters.travel_inside_internal_regions(*m_layer, travel))
// Skip retraction if travel is contained in an internal slice *and*
// internal infill is enabled (so that stringing is entirely not visible).
//FIXME any_internal_region_slice_contains() is potentionally very slow, it shall test for the bounding boxes first.
@ -4485,18 +4499,26 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z)
float new_retract_length = m_config.retraction_length.get_at(extruder_id);
float new_retract_length_toolchange = m_config.retract_length_toolchange.get_at(extruder_id);
int new_filament_temp = this->on_first_layer() ? m_config.nozzle_temperature_initial_layer.get_at(extruder_id): m_config.nozzle_temperature.get_at(extruder_id);
// BBS: if print_z == 0 use first layer temperature
if (abs(print_z) < EPSILON)
new_filament_temp = m_config.nozzle_temperature_initial_layer.get_at(extruder_id);
Vec3d nozzle_pos = m_writer.get_position();
float old_retract_length, old_retract_length_toolchange, wipe_volume;
int old_filament_temp, old_filament_e_feedrate;
float filament_area = float((M_PI / 4.f) * pow(m_config.filament_diameter.get_at(extruder_id), 2));
if (m_writer.extruder() != nullptr) {
//BBS: add handling for filament change in start gcode
int previous_extruder_id = -1;
if (m_writer.extruder() != nullptr || m_start_gcode_filament != -1) {
std::vector<float> flush_matrix(cast<float>(m_config.flush_volumes_matrix.values));
const unsigned int number_of_extruders = (unsigned int)(sqrt(flush_matrix.size()) + EPSILON);
assert(m_writer.extruder()->id() < number_of_extruders);
if (m_writer.extruder() != nullptr)
assert(m_writer.extruder()->id() < number_of_extruders);
else
assert(m_start_gcode_filament < number_of_extruders);
int previous_extruder_id = m_writer.extruder()->id();
previous_extruder_id = m_writer.extruder() != nullptr ? m_writer.extruder()->id() : m_start_gcode_filament;
old_retract_length = m_config.retraction_length.get_at(previous_extruder_id);
old_retract_length_toolchange = m_config.retract_length_toolchange.get_at(previous_extruder_id);
old_filament_temp = this->on_first_layer()? m_config.nozzle_temperature_initial_layer.get_at(previous_extruder_id) : m_config.nozzle_temperature.get_at(previous_extruder_id);
@ -4504,8 +4526,9 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z)
wipe_volume *= m_config.flush_multiplier;
old_filament_e_feedrate = (int)(60.0 * m_config.filament_max_volumetric_speed.get_at(previous_extruder_id) / filament_area);
old_filament_e_feedrate = old_filament_e_feedrate == 0 ? 100 : old_filament_e_feedrate;
}
else {
//BBS: must clean m_start_gcode_filament
m_start_gcode_filament = -1;
} else {
old_retract_length = 0.f;
old_retract_length_toolchange = 0.f;
old_filament_temp = 0;
@ -4517,7 +4540,7 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z)
new_filament_e_feedrate = new_filament_e_feedrate == 0 ? 100 : new_filament_e_feedrate;
DynamicConfig dyn_config;
dyn_config.set_key_value("previous_extruder", new ConfigOptionInt((int)(m_writer.extruder() != nullptr ? m_writer.extruder()->id() : -1)));
dyn_config.set_key_value("previous_extruder", new ConfigOptionInt(previous_extruder_id));
dyn_config.set_key_value("next_extruder", new ConfigOptionInt((int)extruder_id));
dyn_config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index));
dyn_config.set_key_value("layer_z", new ConfigOptionFloat(print_z));
@ -4566,12 +4589,23 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z)
std::string toolchange_gcode_parsed;
if (!change_filament_gcode.empty()) {
toolchange_gcode_parsed = placeholder_parser_process("change_filament_gcode", change_filament_gcode, extruder_id, &dyn_config);
check_add_eol(toolchange_gcode_parsed);
gcode += toolchange_gcode_parsed;
check_add_eol(gcode);
//BBS: gcode writer doesn't know where the extruder is and whether fan speed is changed after inserting tool change gcode
//Set this flag so that normal lift will be used the first time after tool change.
gcode += ";_FORCE_RESUME_FAN_SPEED\n";
m_writer.set_current_position_clear(false);
//BBS
{
//BBS: gcode writer doesn't know where the extruder is and whether fan speed is changed after inserting tool change gcode
//Set this flag so that normal lift will be used the first time after tool change.
gcode += ";_FORCE_RESUME_FAN_SPEED\n";
m_writer.set_current_position_clear(false);
//BBS: check whether custom gcode changes the z position. Update if changed
double temp_z_after_tool_change;
if (GCodeProcessor::get_last_z_from_gcode(toolchange_gcode_parsed, temp_z_after_tool_change)) {
Vec3d pos = m_writer.get_position();
pos(2) = temp_z_after_tool_change;
m_writer.set_position(pos);
}
}
}
// BBS. Reset old extruder E-value.