Merge branch 'main' into dev/bbl-network-upd

# Conflicts:
#	src/slic3r/GUI/SelectMachine.cpp
This commit is contained in:
Noisyfox
2025-06-15 15:28:10 +08:00
94 changed files with 3475 additions and 753 deletions

View File

@@ -200,7 +200,7 @@ SplittedLine do_split_line(const ClipperZUtils::ZPath& path, const ExPolygons& c
// Chain segment back to the original path
ClipperZUtils::ZPoint& front = segment.front();
const ClipperZUtils::ZPoint* previous_src_point;
const ClipperZUtils::ZPoint* previous_src_point = nullptr;
if (is_src(front)) {
// The segment starts with a point from src path, which means apart from the last point,
// all other points on this segment should come from the src path or the clip polygon

View File

@@ -587,9 +587,9 @@ double getadhesionCoeff(const PrintObject* printObject)
}
double adhesionCoeff = 1;
for (const ModelVolume* modelVolume : objectVolumes) {
for (auto iter = extrudersFirstLayer.begin(); iter != extrudersFirstLayer.end(); iter++)
for (auto iter = extrudersFirstLayer.begin(); iter != extrudersFirstLayer.end(); iter++) {
if (modelVolume->extruder_id() == *iter) {
if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end())
if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end()) {
if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PETG" ||
Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PCTG") {
adhesionCoeff = 2;
@@ -597,11 +597,13 @@ double getadhesionCoeff(const PrintObject* printObject)
else if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "TPU") {
adhesionCoeff = 0.5;
}
}
}
}
}
return adhesionCoeff;
/*
/*
def->enum_values.push_back("PLA");
def->enum_values.push_back("PET");
def->enum_values.push_back("ABS");
@@ -1653,7 +1655,7 @@ ExtrusionEntityCollection makeBrimInfill(const ExPolygons& singleBrimArea, const
Polylines loops_pl = to_polylines(loops);
loops_pl_by_levels.assign(loops_pl.size(), Polylines());
tbb::parallel_for(tbb::blocked_range<size_t>(0, loops_pl.size()),
[&loops_pl_by_levels, &loops_pl, &islands_area](const tbb::blocked_range<size_t>& range) {
[&loops_pl_by_levels, &loops_pl /*, &islands_area*/](const tbb::blocked_range<size_t>& range) {
for (size_t i = range.begin(); i < range.end(); ++i) {
loops_pl_by_levels[i] = chain_polylines({ std::move(loops_pl[i]) });
//loops_pl_by_levels[i] = chain_polylines(intersection_pl({ std::move(loops_pl[i]) }, islands_area));

View File

@@ -513,7 +513,7 @@ encoding_check(libslic3r)
target_compile_definitions(libslic3r PUBLIC -DUSE_TBB -DTBB_USE_CAPTURED_EXCEPTION=0)
target_include_directories(libslic3r PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(libslic3r PUBLIC ${EXPAT_INCLUDE_DIRS})
target_include_directories(libslic3r SYSTEM PUBLIC ${EXPAT_INCLUDE_DIRS})
# Find the OCCT and related libraries
set(OpenCASCADE_DIR "${CMAKE_PREFIX_PATH}/lib/cmake/occt")

View File

@@ -94,10 +94,10 @@ template<typename PointType> inline void clip_clipper_polygon_with_subject_bbox_
}
// Never produce just a single point output polygon.
if (!out.empty())
if(get_entire_polygons){
if (!out.empty()) {
if (get_entire_polygons) {
out=src;
}else{
} else {
if (int sides_next = sides(out.front());
// The last point is inside. Take it.
sides_this == 0 ||
@@ -106,7 +106,7 @@ template<typename PointType> inline void clip_clipper_polygon_with_subject_bbox_
(sides_prev & sides_this & sides_next) == 0)
out.emplace_back(src.back());
}
}
}
void clip_clipper_polygon_with_subject_bbox(const Points &src, const BoundingBox &bbox, Points &out, const bool get_entire_polygons) { clip_clipper_polygon_with_subject_bbox_templ(src, bbox, out, get_entire_polygons); }

View File

@@ -257,7 +257,7 @@ ColorRGBA complementary(const ColorRGBA& color)
ColorRGB saturate(const ColorRGB& color, float factor)
{
float h, s, v;
float h = 0.0, s = 0.0, v = 0.0;
RGBtoHSV(color.r(), color.g(), color.b(), h, s, v);
s = std::clamp(s * factor, 0.0f, 1.0f);
float r, g, b;
@@ -272,7 +272,7 @@ ColorRGBA saturate(const ColorRGBA& color, float factor)
ColorRGB opposite(const ColorRGB& color)
{
float h, s, v;
float h = 0.0, s = 0.0, v = 0.0;
RGBtoHSV(color.r(), color.g(), color.b(), h, s, v);
h += 65.0f; // 65 instead 60 to avoid circle values

View File

@@ -61,8 +61,8 @@ void FillConcentric::_fill_surface_single(
size_t iPathFirst = polylines_out.size();
Point last_pos(0, 0);
double min_nozzle_diameter;
bool dir;
double min_nozzle_diameter = 0.0;
bool dir = false;
if (this->print_config != nullptr && params.density >= STAGGER_SEAM_THRESHOLD) {
min_nozzle_diameter = *std::min_element(print_config->nozzle_diameter.values.begin(), print_config->nozzle_diameter.values.end());
dir = rand() % 2;

View File

@@ -845,9 +845,10 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
// All G1 commands should be translated and rotated. X and Y coords are
// only pushed to the output when they differ from last time.
// WT generator can override this by appending the never_skip_tag
if (line.find("G1 ") == 0) {
bool never_skip = false;
auto it = line.find(WipeTower::never_skip_tag());
if (line.find("G1 ") == 0 || line.find("G2 ") == 0 || line.find("G3 ") == 0) {
std::string cur_gcode_start = line.find("G1 ") == 0 ? "G1 " : (line.find("G2 ") == 0 ? "G2 " : "G3 ");
bool never_skip = false;
auto it = line.find(WipeTower::never_skip_tag());
if (it != std::string::npos) {
// remove the tag and remember we saw it
never_skip = true;
@@ -855,7 +856,7 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
}
std::ostringstream line_out;
std::istringstream line_str(line);
line_str >> std::noskipws; // don't skip whitespace
line_str >> std::noskipws; // don't skip whitespace
char ch = 0;
while (line_str >> ch) {
if (ch == 'X' || ch == 'Y')
@@ -869,13 +870,13 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
if (transformed_pos != old_pos || never_skip) {
line = line_out.str();
std::ostringstream oss;
oss << std::fixed << std::setprecision(3) << "G1 ";
oss << std::fixed << std::setprecision(3) << cur_gcode_start;
if (transformed_pos.x() != old_pos.x() || never_skip)
oss << " X" << transformed_pos.x() - extruder_offset.x();
if (transformed_pos.y() != old_pos.y() || never_skip)
oss << " Y" << transformed_pos.y() - extruder_offset.y();
oss << " ";
line.replace(line.find("G1 "), 3, oss.str());
line.replace(line.find(cur_gcode_start), 3, oss.str());
old_pos = transformed_pos;
}
}

View File

@@ -421,11 +421,12 @@ void FanMover::_process_gcode_line(GCodeReader& reader, const GCodeReader::GCode
current_role = ExtrusionEntity::string_to_role(extrusion_string);
}
if (line.raw().size() > 16) {
if (line.raw().rfind("; custom gcode", 0) != std::string::npos)
if (line.raw().rfind("; custom gcode", 0) != std::string::npos) {
if (line.raw().rfind("; custom gcode end", 0) != std::string::npos)
m_is_custom_gcode = false;
else
m_is_custom_gcode = true;
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -10,6 +10,7 @@
#include <algorithm>
#include "libslic3r/Point.hpp"
#include "libslic3r/Polygon.hpp"
#include "WipeTower.hpp"
namespace Slic3r
{
@@ -85,7 +86,8 @@ public:
while (!m_plan.empty() && m_layer_info->z < print_z - WT_EPSILON && m_layer_info+1 != m_plan.end())
++m_layer_info;
m_current_shape = (! this->is_first_layer() && m_current_shape == SHAPE_NORMAL) ? SHAPE_REVERSED : SHAPE_NORMAL;
//m_current_shape = (! this->is_first_layer() && m_current_shape == SHAPE_NORMAL) ? SHAPE_REVERSED : SHAPE_NORMAL;
m_current_shape = SHAPE_NORMAL;
if (this->is_first_layer()) {
m_num_layer_changes = 0;
m_num_tool_changes = 0;
@@ -156,6 +158,8 @@ public:
bool multitool_ramming;
float multitool_ramming_time = 0.f;
float filament_minimal_purge_on_wipe_tower = 0.f;
float retract_length;
float retract_speed;
};
private:
@@ -196,6 +200,14 @@ private:
float m_first_layer_speed = 0.f;
size_t m_first_layer_idx = size_t(-1);
int m_wall_type;
bool m_used_fillet = true;
float m_rib_width = 10;
float m_extra_rib_length = 0;
float m_rib_length = 0;
bool m_enable_arc_fitting = false;
// G-code generator parameters.
float m_cooling_tube_retraction = 0.f;
float m_cooling_tube_length = 0.f;
@@ -315,6 +327,24 @@ private:
WipeTowerWriter2 &writer,
const WipeTower::box_coordinates &cleaning_box,
float wipe_volume);
Polygon generate_support_rib_wall(WipeTowerWriter2& writer,
const WipeTower::box_coordinates& wt_box,
double feedrate,
bool first_layer,
bool rib_wall,
bool extrude_perimeter,
bool skip_points);
Polygon generate_support_cone_wall(
WipeTowerWriter2& writer,
const WipeTower::box_coordinates& wt_box,
double feedrate,
bool infill_cone,
float spacing);
Polygon generate_rib_polygon(const WipeTower::box_coordinates& wt_box);
};

View File

@@ -3200,7 +3200,7 @@ double getadhesionCoeff(const ModelVolumePtrs objectVolumes)
{
double adhesionCoeff = 1;
for (const ModelVolume* modelVolume : objectVolumes) {
if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end())
if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end()) {
if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PETG" ||
Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PCTG") {
adhesionCoeff = 2;
@@ -3208,6 +3208,7 @@ double getadhesionCoeff(const ModelVolumePtrs objectVolumes)
else if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "TPU") {
adhesionCoeff = 0.5;
}
}
}
return adhesionCoeff;
}

View File

@@ -830,7 +830,9 @@ static std::vector<std::string> s_Preset_print_options {
"tree_support_brim_width", "gcode_comments", "gcode_label_objects",
"initial_layer_travel_speed", "exclude_object", "slow_down_layers", "infill_anchor", "infill_anchor_max","initial_layer_min_bead_width",
"make_overhang_printable", "make_overhang_printable_angle", "make_overhang_printable_hole_size" ,"notes",
"wipe_tower_cone_angle", "wipe_tower_extra_spacing","wipe_tower_max_purge_speed", "wipe_tower_filament", "wiping_volumes_extruders","wipe_tower_bridging", "wipe_tower_extra_flow","single_extruder_multi_material_priming",
"wipe_tower_cone_angle", "wipe_tower_extra_spacing","wipe_tower_max_purge_speed",
"wipe_tower_wall_type", "wipe_tower_extra_rib_length", "wipe_tower_rib_width", "wipe_tower_fillet_wall",
"wipe_tower_filament", "wiping_volumes_extruders","wipe_tower_bridging", "wipe_tower_extra_flow","single_extruder_multi_material_priming",
"wipe_tower_rotation_angle", "tree_support_branch_distance_organic", "tree_support_branch_diameter_organic", "tree_support_branch_angle_organic",
"hole_to_polyhole", "hole_to_polyhole_threshold", "hole_to_polyhole_twisted", "mmu_segmented_region_max_width", "mmu_segmented_region_interlocking_depth",
"small_area_infill_flow_compensation", "small_area_infill_flow_compensation_model",

View File

@@ -304,6 +304,10 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|| opt_key == "wipe_tower_cone_angle"
|| opt_key == "wipe_tower_extra_spacing"
|| opt_key == "wipe_tower_max_purge_speed"
|| opt_key == "wipe_tower_wall_type"
|| opt_key == "wipe_tower_extra_rib_length"
|| opt_key == "wipe_tower_rib_width"
|| opt_key == "wipe_tower_fillet_wall"
|| opt_key == "wipe_tower_filament"
|| opt_key == "wiping_volumes_extruders"
|| opt_key == "enable_filament_ramming"

View File

@@ -445,6 +445,13 @@ static const t_config_enum_values s_keys_map_CounterboreHoleBridgingOption{
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(CounterboreHoleBridgingOption)
static const t_config_enum_values s_keys_map_WipeTowerWallType{
{"rectangle", wtwRectangle},
{"cone", wtwCone},
{"rib", wtwRib},
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(WipeTowerWallType)
static void assign_printer_technology_to_unknown(t_optiondef_map &options, PrinterTechnology printer_technology)
{
for (std::pair<const t_config_option_key, ConfigOptionDef> &kvp : options)
@@ -5394,7 +5401,7 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->min = 0.;
def->max = 90.;
def->set_default_value(new ConfigOptionFloat(0.));
def->set_default_value(new ConfigOptionFloat(30.0));
def = this->add("wipe_tower_max_purge_speed", coFloat);
def->label = L("Maximum wipe tower print speed");
@@ -5409,6 +5416,46 @@ void PrintConfigDef::init_fff_params()
def->min = 10;
def->set_default_value(new ConfigOptionFloat(90.));
def = this->add("wipe_tower_wall_type", coEnum);
def->label = L("Wall type");
def->tooltip = L("Wipe tower outer wall type.\n"
"1. Rectangle: The default wall type, a rectangle with fixed width and height.\n"
"2. Cone: A cone with a fillet at the bottom to help stabilize the wipe tower.\n"
"3. Rib: Adds four ribs to the tower wall for enhanced stability.");
def->enum_keys_map = &ConfigOptionEnum<WipeTowerWallType>::get_enum_values();
def->enum_values.emplace_back("rectangle");
def->enum_values.emplace_back("cone");
def->enum_values.emplace_back("rib");
def->enum_labels.emplace_back("Rectangle");
def->enum_labels.emplace_back("Cone");
def->enum_labels.emplace_back("Rib");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<WipeTowerWallType>(wtwRectangle));
def = this->add("wipe_tower_extra_rib_length", coFloat);
def->label = L("Extra rib length");
def->tooltip = L("Positive values can increase the size of the rib wall, while negative values can reduce the size."
"However, the size of the rib wall can not be smaller than that determined by the cleaning volume.");
def->sidetext = L("mm");
def->max = 300;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0));
def = this->add("wipe_tower_rib_width", coFloat);
def->label = L("Rib width");
def->tooltip = L("Rib width");
def->sidetext = L("mm");
def->mode = comAdvanced;
def->min = 0;
def->set_default_value(new ConfigOptionFloat(8));
def = this->add("wipe_tower_fillet_wall", coBool);
def->label = L("Fillet wall");
def->tooltip = L("The wall of prime tower will fillet.");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(true));
def = this->add("wipe_tower_filament", coInt);
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
def->label = L("Wipe tower");

View File

@@ -345,6 +345,12 @@ enum CounterboreHoleBridgingOption {
chbNone, chbBridges, chbFilled
};
enum WipeTowerWallType {
wtwRectangle = 0,
wtwCone,
wtwRib
};
static std::string bed_type_to_gcode_string(const BedType type)
{
std::string type_str;
@@ -452,7 +458,9 @@ CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(GCodeThumbnailsFormat)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(CounterboreHoleBridgingOption)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(PrintHostType)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(AuthorizationType)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(WipeTowerWallType)
CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(PerimeterGeneratorType)
#undef CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS
class DynamicPrintConfig;
@@ -1340,6 +1348,10 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionFloat, wipe_tower_cone_angle))
((ConfigOptionPercent, wipe_tower_extra_spacing))
((ConfigOptionFloat, wipe_tower_max_purge_speed))
((ConfigOptionEnum<WipeTowerWallType>, wipe_tower_wall_type))
((ConfigOptionFloat, wipe_tower_extra_rib_length))
((ConfigOptionFloat, wipe_tower_rib_width))
((ConfigOptionBool, wipe_tower_fillet_wall))
((ConfigOptionInt, wipe_tower_filament))
((ConfigOptionFloats, wiping_volumes_extruders))
((ConfigOptionInts, idle_temperature))

View File

@@ -2474,7 +2474,7 @@ void cut_mesh(const indexed_triangle_set& mesh, float z, indexed_triangle_set* u
// intersect v0-v1 and v2-v0 with cutting plane and make new vertices
auto new_vertex = [upper, lower, &upper_slice_vertices, &lower_slice_vertices](const Vec3f &a, const int ia, const Vec3f &b, const int ib, const Vec3f &c,
const int ic, const Vec3f &new_pt, bool &is_new_vertex) {
int iupper, ilower;
int iupper = 0, ilower = 0;
is_new_vertex = false;
if (is_equal(new_pt, a))
iupper = ilower = ia;