Merge branch 'main' into feature/multitool

This commit is contained in:
SoftFever 2024-07-16 23:30:26 +08:00 committed by GitHub
commit a9668728bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
223 changed files with 10502 additions and 2428 deletions

View file

@ -253,6 +253,10 @@ void AppConfig::set_defaults()
set_bool("show_splash_screen", true);
}
if(get("auto_arrange").empty()) {
set_bool("auto_arrange", true);
}
if (get("show_model_mesh").empty()) {
set_bool("show_model_mesh", false);
}

View file

@ -715,7 +715,7 @@ bool compSecondMoment(const ExPolygons& expolys, double& smExpolysX, double& smE
//BBS: config brimwidth by volumes
double configBrimWidthByVolumes(double deltaT, double adhension, double maxSpeed, const ModelVolume* modelVolumePtr, const ExPolygons& expolys)
double configBrimWidthByVolumes(double deltaT, double adhesion, double maxSpeed, const ModelVolume* modelVolumePtr, const ExPolygons& expolys)
{
// height of a volume
double height = 0;
@ -745,7 +745,7 @@ double configBrimWidthByVolumes(double deltaT, double adhension, double maxSpeed
double thermalLengthRef = Model::getThermalLength(modelVolumePtr);
double height_to_area = std::max(height / Ixx * (bbox2.size()(1) * SCALING_FACTOR), height / Iyy * (bbox2.size()(0) * SCALING_FACTOR));
double brim_width = adhension * std::min(std::min(std::max(height_to_area * maxSpeed / 24, thermalLength * 8. / thermalLengthRef * std::min(height, 30.) / 30.), 18.), 1.5 * thermalLength);
double brim_width = adhesion * std::min(std::min(std::max(height_to_area * maxSpeed / 24, thermalLength * 8. / thermalLengthRef * std::min(height, 30.) / 30.), 18.), 1.5 * thermalLength);
// small brims are omitted
if (brim_width < 5 && brim_width < 1.5 * thermalLength)
brim_width = 0;
@ -756,7 +756,7 @@ double configBrimWidthByVolumes(double deltaT, double adhension, double maxSpeed
}
//BBS: config brimwidth by group of volumes
double configBrimWidthByVolumeGroups(double adhension, double maxSpeed, const std::vector<ModelVolume*> modelVolumePtrs, const ExPolygons& expolys, double &groupHeight)
double configBrimWidthByVolumeGroups(double adhesion, double maxSpeed, const std::vector<ModelVolume*> modelVolumePtrs, const ExPolygons& expolys, double &groupHeight)
{
// height of a group of volumes
double height = 0;
@ -794,7 +794,7 @@ double configBrimWidthByVolumeGroups(double adhension, double maxSpeed, const st
double thermalLengthRef = Model::getThermalLength(modelVolumePtrs);
double height_to_area = std::max(height / Ixx * (bbox2.size()(1) * SCALING_FACTOR), height / Iyy * (bbox2.size()(0) * SCALING_FACTOR)) * height / 1920;
double brim_width = adhension * std::min(std::min(std::max(height_to_area * maxSpeed, thermalLength * 8. / thermalLengthRef * std::min(height, 30.) / 30.), 18.), 1.5 * thermalLength);
double brim_width = adhesion * std::min(std::min(std::max(height_to_area * maxSpeed, thermalLength * 8. / thermalLengthRef * std::min(height, 30.) / 30.), 18.), 1.5 * thermalLength);
// small brims are omitted
if (brim_width < 5 && brim_width < 1.5 * thermalLength)
brim_width = 0;
@ -902,7 +902,7 @@ static ExPolygons outer_inner_brim_area(const Print& print,
Polygons holes_support;
if (objectWithExtruder.second == extruderNo && brimToWrite.at(object->id()).obj) {
double deltaT = getTemperatureFromExtruder(object);
double adhension = getadhesionCoeff(object);
double adhesion = getadhesionCoeff(object);
double maxSpeed = Model::findMaxSpeed(object->model_object());
// BBS: brims are generated by volume groups
for (const auto& volumeGroup : object->firstLayerObjGroups()) {
@ -926,11 +926,11 @@ static ExPolygons outer_inner_brim_area(const Print& print,
double groupHeight = 0.;
// config brim width in auto-brim mode
if (has_brim_auto) {
double brimWidthRaw = configBrimWidthByVolumeGroups(adhension, maxSpeed, groupVolumePtrs, volumeGroup.slices, groupHeight);
double brimWidthRaw = configBrimWidthByVolumeGroups(adhesion, maxSpeed, groupVolumePtrs, volumeGroup.slices, groupHeight);
brim_width = scale_(floor(brimWidthRaw / flowWidth / 2) * flowWidth * 2);
}
for (const ExPolygon& ex_poly : volumeGroup.slices) {
// BBS: additional brim width will be added if part's adhension area is too small and brim is not generated
// BBS: additional brim width will be added if part's adhesion area is too small and brim is not generated
float brim_width_mod;
if (brim_width < scale_(5.) && has_brim_auto && groupHeight > 10.) {
brim_width_mod = ex_poly.area() / ex_poly.contour.length() < scaled_half_min_adh_length
@ -1024,7 +1024,7 @@ static ExPolygons outer_inner_brim_area(const Print& print,
// BBS
if (!object->support_layers().empty() && object->support_layers().front()->support_type == stInnerTree) {
for (const ExPolygon &ex_poly : object->support_layers().front()->lslices) {
// BBS: additional brim width will be added if adhension area is too small without brim
// BBS: additional brim width will be added if adhesion area is too small without brim
float brim_width_mod = ex_poly.area() / ex_poly.contour.length() < scaled_half_min_adh_length
&& brim_width < scaled_flow_width ? brim_width + scaled_additional_brim_width : brim_width;
brim_width_mod = floor(brim_width_mod / scaled_flow_width / 2) * scaled_flow_width * 2;

View file

@ -580,6 +580,10 @@ target_link_libraries(libslic3r
opencv_world
)
if(NOT SLIC3R_STATIC)
target_compile_definitions(libslic3r PUBLIC BOOST_ALL_DYN_LINK)
endif()
if(NOT WIN32)
target_link_libraries(libslic3r freetype)
if (NOT APPLE)

View file

@ -2,6 +2,7 @@
#include "../miniz_extension.hpp"
#include "format.hpp"
#include <boost/algorithm/string/case_conv.hpp>
#include <qoi/qoi.h>
#include <jpeglib.h>
#include <jerror.h>
@ -594,7 +595,7 @@ std::string get_error_string(const ThumbnailErrors& errors)
std::string error_str;
if (errors.has(ThumbnailError::InvalidVal))
error_str += "\n - " + format("Invalid input format. Expected vector of dimensions in the following format: \"%1%\"", "XxY/EXT, XxY/EXT, ...");
error_str += "\n - " + Slic3r::format("Invalid input format. Expected vector of dimensions in the following format: \"%1%\"", "XxY/EXT, XxY/EXT, ...");
if (errors.has(ThumbnailError::OutOfRange))
error_str += "\n - Input value is out of range";
if (errors.has(ThumbnailError::InvalidExt))

View file

@ -3,6 +3,7 @@
#include "../Point.hpp"
#include "../PrintConfig.hpp"
#include "../enum_bitmask.hpp"
#include "ThumbnailData.hpp"
#include "../enum_bitmask.hpp"

View file

@ -1466,7 +1466,7 @@ WipeTower::ToolChangeResult WipeTower2::finish_layer()
return poly;
};
feedrate = first_layer ? m_first_layer_speed * 60.f : m_perimeter_speed * 60.f;
feedrate = first_layer ? m_first_layer_speed * 60.f : std::min(m_wipe_tower_max_purge_speed * 60.f, m_perimeter_speed * 60.f);
// outer contour (always)
bool infill_cone = first_layer && m_wipe_tower_width > 2*spacing && m_wipe_tower_depth > 2*spacing;

View file

@ -6,6 +6,7 @@
#undef PI
#include <boost/next_prior.hpp>
#include "boost/log/trivial.hpp"
// Include igl first. It defines "L" macro which then clashes with our localization
#include <igl/copyleft/cgal/mesh_boolean.h>
#undef L
@ -27,7 +28,6 @@
#include <CGAL/boost/graph/Face_filtered_graph.h>
// BBS: for boolean using mcut
#include "mcut/include/mcut/mcut.h"
#include "boost/log/trivial.hpp"
namespace Slic3r {
namespace MeshBoolean {

View file

@ -3115,8 +3115,8 @@ double Model::getThermalLength(const std::vector<ModelVolume*> modelVolumePtrs)
}
return thermalLength;
}
// max printing speed, difference in bed temperature and envirument temperature and bed adhension coefficients are considered
double ModelInstance::get_auto_brim_width(double deltaT, double adhension) const
// max printing speed, difference in bed temperature and envirument temperature and bed adhesion coefficients are considered
double ModelInstance::get_auto_brim_width(double deltaT, double adhesion) const
{
BoundingBoxf3 raw_bbox = object->raw_mesh_bounding_box();
double maxSpeed = Model::findMaxSpeed(object);
@ -3127,7 +3127,7 @@ double ModelInstance::get_auto_brim_width(double deltaT, double adhension) const
double thermalLength = sqrt(bbox_size(0)* bbox_size(0) + bbox_size(1)* bbox_size(1));
double thermalLengthRef = Model::getThermalLength(object->volumes);
double brim_width = adhension * std::min(std::min(std::max(height_to_area * 200 * maxSpeed/200, thermalLength * 8. / thermalLengthRef * std::min(bbox_size(2), 30.) / 30.), 20.), 1.5 * thermalLength);
double brim_width = adhesion * std::min(std::min(std::max(height_to_area * 200 * maxSpeed/200, thermalLength * 8. / thermalLengthRef * std::min(bbox_size(2), 30.) / 30.), 20.), 1.5 * thermalLength);
// small brims are omitted
if (brim_width < 5 && brim_width < 1.5 * thermalLength)
brim_width = 0;

View file

@ -1322,7 +1322,7 @@ public:
bool is_assemble_initialized() { return m_assemble_initialized; }
//BBS
double get_auto_brim_width(double deltaT, double adhension) const;
double get_auto_brim_width(double deltaT, double adhesion) const;
double get_auto_brim_width() const;
// BBS
Polygon convex_hull_2d();

View file

@ -12,7 +12,6 @@
#include <boost/lexical_cast.hpp>
#include <boost/log/trivial.hpp>
#include <boost/thread.hpp>
#include <float.h>
namespace {
@ -2359,7 +2358,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("initial_layer_print_height", coFloat);
def->label = L("Initial layer height");
def->category = L("Quality");
def->tooltip = L("Height of initial layer. Making initial layer height to be thick slightly can improve build plate adhension");
def->tooltip = L("Height of initial layer. Making initial layer height to be thick slightly can improve build plate adhesion");
def->sidetext = L("mm");
def->min = 0;
def->set_default_value(new ConfigOptionFloat(0.2));
@ -6100,7 +6099,7 @@ void PrintConfigDef::handle_legacy_composite(DynamicPrintConfig &config)
auto [thumbnails_list, errors] = GCodeThumbnails::make_and_check_thumbnail_list(thumbnails_str, extention);
if (errors != enum_bitmask<ThumbnailError>()) {
std::string error_str = "\n" + format("Invalid value provided for parameter %1%: %2%", "thumbnails", thumbnails_str);
std::string error_str = "\n" + Slic3r::format("Invalid value provided for parameter %1%: %2%", "thumbnails", thumbnails_str);
error_str += GCodeThumbnails::get_error_string(errors);
throw BadOptionValueException(error_str);
}
@ -6109,7 +6108,7 @@ void PrintConfigDef::handle_legacy_composite(DynamicPrintConfig &config)
const auto& extentions = ConfigOptionEnum<GCodeThumbnailsFormat>::get_enum_names();
thumbnails_str.clear();
for (const auto& [ext, size] : thumbnails_list)
thumbnails_str += format("%1%x%2%/%3%, ", size.x(), size.y(), extentions[int(ext)]);
thumbnails_str += Slic3r::format("%1%x%2%/%3%, ", size.x(), size.y(), extentions[int(ext)]);
thumbnails_str.resize(thumbnails_str.length() - 2);
config.set_key_value("thumbnails", new ConfigOptionString(thumbnails_str));