Merge branch 'master-remote' into feature/1.5

Signed-off-by: SoftFever <softfeverever@gmail.com>

# Conflicts:
#	bbl/i18n/BambuStudio.pot
#	bbl/i18n/de/BambuStudio_de.po
#	bbl/i18n/en/BambuStudio_en.po
#	bbl/i18n/es/BambuStudio_es.po
#	bbl/i18n/fr/BambuStudio_fr.po
#	bbl/i18n/hu/BambuStudio_hu.po
#	bbl/i18n/it/BambuStudio_it.po
#	bbl/i18n/nl/BambuStudio_nl.po
#	bbl/i18n/sv/BambuStudio_sv.po
#	bbl/i18n/zh_cn/BambuStudio_zh_CN.po
#	deps/Boost/Boost.cmake
#	deps/wxWidgets/wxWidgets.cmake
#	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/nl/BambuStudio.mo
#	resources/i18n/sv/BambuStudio.mo
#	resources/i18n/zh_cn/BambuStudio.mo
#	resources/images/tips_arrow.svg
#	resources/profiles/Anycubic.json
#	resources/profiles/Anycubic/filament/Anycubic Generic ABS.json
#	resources/profiles/Anycubic/filament/Anycubic Generic ASA.json
#	resources/profiles/Anycubic/filament/Anycubic Generic PA-CF.json
#	resources/profiles/Anycubic/filament/Anycubic Generic PA.json
#	resources/profiles/Anycubic/filament/Anycubic Generic PC.json
#	resources/profiles/Anycubic/filament/Anycubic Generic PETG.json
#	resources/profiles/Anycubic/filament/Anycubic Generic PLA-CF.json
#	resources/profiles/Anycubic/filament/Anycubic Generic PLA.json
#	resources/profiles/Anycubic/filament/Anycubic Generic PVA.json
#	resources/profiles/Anycubic/filament/Anycubic Generic TPU.json
#	resources/profiles/Anycubic/filament/fdm_filament_common.json
#	resources/profiles/Anycubic/machine/Anycubic 4Max Pro 0.4 nozzle.json
#	resources/profiles/Anycubic/machine/Anycubic 4Max Pro.json
#	resources/profiles/Anycubic/process/0.20mm Standard @4MaxPro.json
#	resources/profiles/Anycubic/process/fdm_process_common.json
#	resources/profiles/BBL.json
#	resources/profiles/BBL/machine/Bambu Lab P1P 0.2 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab P1P 0.6 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab P1P 0.8 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 0.2 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 0.6 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 0.8 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.2 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.4 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.6 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.8 nozzle.json
#	resources/profiles/BBL/machine/fdm_bbl_3dp_001_common.json
#	resources/profiles/Voron.json
#	resources/web/data/text.js
#	resources/web/image/printer/Anycubic 4Max Pro_cover.png
#	src/BambuStudio.cpp
#	src/libslic3r/GCode.cpp
#	src/libslic3r/GCode.hpp
#	src/libslic3r/GCode/GCodeProcessor.cpp
#	src/libslic3r/GCodeWriter.hpp
#	src/libslic3r/PerimeterGenerator.cpp
#	src/libslic3r/PresetBundle.cpp
#	src/libslic3r/Print.cpp
#	src/libslic3r/Print.hpp
#	src/libslic3r/PrintConfig.cpp
#	src/libslic3r/PrintConfig.hpp
#	src/libslic3r/PrintObject.cpp
#	src/slic3r/GUI/AMSMaterialsSetting.cpp
#	src/slic3r/GUI/AMSMaterialsSetting.hpp
#	src/slic3r/GUI/AmsMappingPopup.cpp
#	src/slic3r/GUI/AmsMappingPopup.hpp
#	src/slic3r/GUI/Auxiliary.cpp
#	src/slic3r/GUI/BackgroundSlicingProcess.cpp
#	src/slic3r/GUI/ConfigManipulation.cpp
#	src/slic3r/GUI/DeviceManager.cpp
#	src/slic3r/GUI/DeviceManager.hpp
#	src/slic3r/GUI/ExtrusionCalibration.cpp
#	src/slic3r/GUI/GCodeViewer.cpp
#	src/slic3r/GUI/GCodeViewer.hpp
#	src/slic3r/GUI/GUI_App.cpp
#	src/slic3r/GUI/IMSlider.cpp
#	src/slic3r/GUI/Jobs/PrintJob.cpp
#	src/slic3r/GUI/Jobs/PrintJob.hpp
#	src/slic3r/GUI/Jobs/SendJob.cpp
#	src/slic3r/GUI/Jobs/SendJob.hpp
#	src/slic3r/GUI/MainFrame.cpp
#	src/slic3r/GUI/MainFrame.hpp
#	src/slic3r/GUI/MediaPlayCtrl.cpp
#	src/slic3r/GUI/OptionsGroup.cpp
#	src/slic3r/GUI/PhysicalPrinterDialog.cpp
#	src/slic3r/GUI/Plater.cpp
#	src/slic3r/GUI/PrintHostDialogs.cpp
#	src/slic3r/GUI/Printer/BambuTunnel.h
#	src/slic3r/GUI/Printer/PrinterFileSystem.cpp
#	src/slic3r/GUI/Printer/gstbambusrc.c
#	src/slic3r/GUI/Printer/gstbambusrc.h
#	src/slic3r/GUI/ReleaseNote.cpp
#	src/slic3r/GUI/ReleaseNote.hpp
#	src/slic3r/GUI/SelectMachine.cpp
#	src/slic3r/GUI/SendToPrinter.cpp
#	src/slic3r/GUI/SetBedTypeDialog.cpp
#	src/slic3r/GUI/StatusPanel.cpp
#	src/slic3r/GUI/StatusPanel.hpp
#	src/slic3r/GUI/Tab.cpp
#	src/slic3r/GUI/Widgets/AMSControl.cpp
#	src/slic3r/GUI/Widgets/AMSControl.hpp
#	src/slic3r/GUI/Widgets/ImageSwitchButton.cpp
#	src/slic3r/GUI/Widgets/Label.cpp
#	src/slic3r/GUI/WipeTowerDialog.cpp
#	src/slic3r/Utils/Process.cpp
#	src/slic3r/Utils/bambu_networking.hpp
#	version.inc
This commit is contained in:
SoftFever 2023-03-08 00:08:26 +08:00
commit 5ef51f6c8a
339 changed files with 37169 additions and 5445 deletions

View file

@ -91,7 +91,6 @@ PrintObject::~PrintObject()
if (m_shared_regions && -- m_shared_regions->m_ref_cnt == 0) delete m_shared_regions;
clear_layers();
clear_support_layers();
clear_tree_support_layers();
}
PrintBase::ApplyStatus PrintObject::set_instances(PrintInstances &&instances)
@ -410,11 +409,49 @@ void PrintObject::ironing()
}
}
// BBS
void PrintObject::clear_overhangs_for_lift()
{
if (!m_shared_object) {
for (Layer* l : m_layers)
l->loverhangs.clear();
}
}
static const float g_min_overhang_percent_for_lift = 0.3f;
void PrintObject::detect_overhangs_for_lift()
{
if (this->set_started(posDetectOverhangsForLift)) {
const float min_overlap = m_config.line_width * g_min_overhang_percent_for_lift;
size_t num_layers = this->layer_count();
size_t num_raft_layers = m_slicing_params.raft_layers();
m_print->set_status(78, L("Detect overhangs for auto-lift"));
this->clear_overhangs_for_lift();
tbb::spin_mutex layer_storage_mutex;
tbb::parallel_for(tbb::blocked_range<size_t>(num_raft_layers + 1, num_layers),
[this, min_overlap](const tbb::blocked_range<size_t>& range)
{
for (size_t layer_id = range.begin(); layer_id < range.end(); ++layer_id) {
Layer& layer = *m_layers[layer_id];
Layer& lower_layer = *layer.lower_layer;
ExPolygons overhangs = diff_ex(layer.lslices, offset_ex(lower_layer.lslices, scale_(min_overlap)));
layer.loverhangs = std::move(offset2_ex(overhangs, -0.1f * scale_(m_config.line_width), 0.1f * scale_(m_config.line_width)));
}
});
this->set_done(posDetectOverhangsForLift);
}
}
void PrintObject::generate_support_material()
{
if (this->set_started(posSupportMaterial)) {
this->clear_support_layers();
this->clear_tree_support_layers();
if ((this->has_support() && m_layers.size() > 1) || (this->has_raft() && ! m_layers.empty())) {
m_print->set_status(50, L("Generating support"));
@ -483,16 +520,6 @@ void PrintObject::simplify_extrusion_path()
}
);
m_print->throw_if_canceled();
tbb::parallel_for(
tbb::blocked_range<size_t>(0, m_tree_support_layers.size()),
[this](const tbb::blocked_range<size_t>& range) {
for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++ layer_idx) {
m_print->throw_if_canceled();
m_tree_support_layers[layer_idx]->simplify_support_extrusion_path();
}
}
);
m_print->throw_if_canceled();
BOOST_LOG_TRIVIAL(debug) << "Simplify extrusion path of support in parallel - end";
this->set_done(posSimplifySupportPath);
}
@ -564,19 +591,6 @@ Layer* PrintObject::add_layer(int id, coordf_t height, coordf_t print_z, coordf_
return m_layers.back();
}
// BBS
const TreeSupportLayer* PrintObject::get_tree_support_layer_at_printz(coordf_t print_z, coordf_t epsilon) const
{
coordf_t limit = print_z - epsilon;
auto it = Slic3r::lower_bound_by_predicate(m_tree_support_layers.begin(), m_tree_support_layers.end(), [limit](const TreeSupportLayer* layer) { return layer->print_z < limit; });
return (it == m_tree_support_layers.end() || (*it)->print_z > print_z + epsilon) ? nullptr : *it;
}
TreeSupportLayer* PrintObject::get_tree_support_layer_at_printz(coordf_t print_z, coordf_t epsilon)
{
return const_cast<TreeSupportLayer*>(std::as_const(*this).get_tree_support_layer_at_printz(print_z, epsilon));
}
const SupportLayer* PrintObject::get_support_layer_at_printz(coordf_t print_z, coordf_t epsilon) const
{
coordf_t limit = print_z - epsilon;
@ -589,12 +603,17 @@ SupportLayer* PrintObject::get_support_layer_at_printz(coordf_t print_z, coordf_
return const_cast<SupportLayer*>(std::as_const(*this).get_support_layer_at_printz(print_z, epsilon));
}
void PrintObject::clear_tree_support_layers()
void PrintObject::clear_support_layers()
{
if (!m_shared_object) {
for (TreeSupportLayer* l : m_tree_support_layers)
for (SupportLayer* l : m_support_layers)
delete l;
m_tree_support_layers.clear();
m_support_layers.clear();
for (auto l : m_layers) {
l->sharp_tails.clear();
l->sharp_tails_height.clear();
l->cantilevers.clear();
}
}
}
@ -614,19 +633,11 @@ std::shared_ptr<TreeSupportData> PrintObject::alloc_tree_support_preview_cache()
return m_tree_support_preview_cache;
}
TreeSupportLayer* PrintObject::add_tree_support_layer(int id, coordf_t height, coordf_t print_z, coordf_t slice_z)
SupportLayer* PrintObject::add_tree_support_layer(int id, coordf_t height, coordf_t print_z, coordf_t slice_z)
{
m_tree_support_layers.emplace_back(new TreeSupportLayer(id, this, height, print_z, slice_z));
return m_tree_support_layers.back();
}
void PrintObject::clear_support_layers()
{
if (!m_shared_object) {
for (Layer *l : m_support_layers)
delete l;
m_support_layers.clear();
}
m_support_layers.emplace_back(new SupportLayer(id, 0, this, height, print_z, slice_z));
m_support_layers.back()->support_type = stInnerTree;
return m_support_layers.back();
}
SupportLayer* PrintObject::add_support_layer(int id, int interface_id, coordf_t height, coordf_t print_z)
@ -717,7 +728,14 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "support_top_z_distance"
|| opt_key == "support_bottom_z_distance"
|| opt_key == "xy_hole_compensation"
|| opt_key == "xy_contour_compensation") {
|| opt_key == "xy_contour_compensation"
//BBS: [Arthur] the following params affect bottomBridge surface type detection
|| opt_key == "support_type"
|| opt_key == "bridge_no_support"
|| opt_key == "max_bridge_length"
|| opt_key == "support_interface_top_layers"
|| opt_key == "support_critical_regions_only"
) {
steps.emplace_back(posSlice);
} else if (opt_key == "enable_support") {
steps.emplace_back(posSupportMaterial);
@ -762,9 +780,23 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "tree_support_branch_angle"
|| opt_key == "tree_support_wall_count") {
steps.emplace_back(posSupportMaterial);
} else if (opt_key == "bottom_shell_layers") {
} else if (
opt_key == "bottom_shell_layers"
|| opt_key == "top_shell_layers") {
steps.emplace_back(posPrepareInfill);
if (m_print->config().spiral_mode) {
const auto *old_shell_layers = old_config.option<ConfigOptionInt>(opt_key);
const auto *new_shell_layers = new_config.option<ConfigOptionInt>(opt_key);
assert(old_shell_layers && new_shell_layers);
bool value_changed = (old_shell_layers->value == 0 && new_shell_layers->value > 0) ||
(old_shell_layers->value > 0 && new_shell_layers->value == 0);
if (value_changed && this->object_extruders().size() > 1) {
steps.emplace_back(posSlice);
}
else if (m_print->config().spiral_mode && opt_key == "bottom_shell_layers") {
// Changing the number of bottom layers when a spiral vase is enabled requires re-slicing the object again.
// Otherwise, holes in the bottom layers could be filled, as is reported in GH #5528.
steps.emplace_back(posSlice);
@ -773,7 +805,6 @@ bool PrintObject::invalidate_state_by_config_options(
opt_key == "interface_shells"
|| opt_key == "infill_combination"
|| opt_key == "bottom_shell_thickness"
|| opt_key == "top_shell_layers"
|| opt_key == "top_shell_thickness"
|| opt_key == "minimum_sparse_infill_area"
|| opt_key == "sparse_infill_filament"
@ -971,9 +1002,17 @@ void PrintObject::detect_surfaces_type()
[this, region_id, interface_shells, &surfaces_new](const tbb::blocked_range<size_t>& range) {
// If we have soluble support material, don't bridge. The overhang will be squished against a soluble layer separating
// the support from the print.
SurfaceType surface_type_bottom_other =
(this->has_support() && m_config.support_top_z_distance.value == 0) ?
stBottom : stBottomBridge;
// BBS: the above logic only applys for normal(auto) support. Complete logic:
// 1. has support, top z distance=0 (soluble material), auto support
// 2. for normal(auto), bridge_no_support is off
// 3. for tree(auto), interface top layers=0, max bridge length=0, support_critical_regions_only=false (only in this way the bridge is fully supported)
bool bottom_is_fully_supported = this->has_support() && m_config.support_top_z_distance.value == 0 && is_auto(m_config.support_type.value);
if (m_config.support_type.value == stNormalAuto)
bottom_is_fully_supported &= !m_config.bridge_no_support.value;
else if (m_config.support_type.value == stTreeAuto) {
bottom_is_fully_supported &= (m_config.support_interface_top_layers.value > 0 && m_config.max_bridge_length.value == 0 && m_config.support_critical_regions_only.value==false);
}
SurfaceType surface_type_bottom_other = bottom_is_fully_supported ? stBottom : stBottomBridge;
for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++ idx_layer) {
m_print->throw_if_canceled();
// BOOST_LOG_TRIVIAL(trace) << "Detecting solid surfaces for region " << region_id << " and layer " << layer->print_z;
@ -2389,7 +2428,7 @@ void PrintObject::_generate_support_material()
support_material.generate(*this);
TreeSupport tree_support(*this, m_slicing_params);
tree_support.generate_support_areas();
tree_support.generate();
}
// BBS
@ -2545,6 +2584,7 @@ template void PrintObject::remove_bridges_from_contacts<Polygons>(
SupportNecessaryType PrintObject::is_support_necessary()
{
#if 0
static const double super_overhang_area_threshold = SQ(scale_(5.0));
double threshold_rad = (m_config.support_threshold_angle.value < EPSILON ? 30 : m_config.support_threshold_angle.value + 1) * M_PI / 180.;
@ -2627,7 +2667,16 @@ SupportNecessaryType PrintObject::is_support_necessary()
if (!exceed_overhang.empty())
return LargeOverhang;
}
#else
TreeSupport tree_support(*this, m_slicing_params);
tree_support.support_type = SupportType::stTreeAuto; // need to set support type to fully utilize the power of feature detection
tree_support.detect_overhangs();
this->clear_support_layers();
if (tree_support.has_sharp_tails)
return SharpTail;
else if (tree_support.has_cantilever)
return LargeOverhang;
#endif
return NoNeedSupp;
}
@ -2820,10 +2869,6 @@ static void project_triangles_to_slabs(ConstLayerPtrsAdaptor layers, const index
void PrintObject::project_and_append_custom_facets(
bool seam, EnforcerBlockerType type, std::vector<Polygons>& out) const
{
// BBS: Approve adding enforcer support on vertical faces
SlabSlicingConfig config;
config.isVertical = type == EnforcerBlockerType::ENFORCER ? true : false;
for (const ModelVolume* mv : this->model_object()->volumes)
if (mv->is_model_part()) {
const indexed_triangle_set custom_facets = seam
@ -2837,7 +2882,7 @@ void PrintObject::project_and_append_custom_facets(
else {
std::vector<Polygons> projected;
// Support blockers or enforcers. Project downward facing painted areas upwards to their respective slicing plane.
slice_mesh_slabs(custom_facets, zs_from_layers(this->layers()), this->trafo_centered() * mv->get_matrix(), nullptr, &projected, [](){}, config);
slice_mesh_slabs(custom_facets, zs_from_layers(this->layers()), this->trafo_centered() * mv->get_matrix(), nullptr, &projected, [](){});
// Merge these projections with the output, layer by layer.
assert(! projected.empty());
assert(out.empty() || out.size() == projected.size());