update libslic3r

This commit is contained in:
QIDI TECH
2024-11-28 15:12:18 +08:00
parent 459e7822db
commit a26696f35e
115 changed files with 15117 additions and 4090 deletions

View File

@@ -538,7 +538,6 @@ void PrintObject::simplify_extrusion_path()
}
if (this->set_started(posSimplifySupportPath)) {
//QDS: share same progress
m_print->set_status(75, L("Optimizing toolpath"));
BOOST_LOG_TRIVIAL(debug) << "Simplify extrusion path of support in parallel - start";
tbb::parallel_for(
@@ -649,14 +648,8 @@ void PrintObject::clear_support_layers()
std::shared_ptr<TreeSupportData> PrintObject::alloc_tree_support_preview_cache()
{
if (!m_tree_support_preview_cache) {
const coordf_t layer_height = m_config.layer_height.value;
const coordf_t xy_distance = m_config.support_object_xy_distance.value;
const double angle = m_config.tree_support_branch_angle.value * M_PI / 180.;
const coordf_t max_move_distance
= (angle < M_PI / 2) ? (coordf_t)(tan(angle) * layer_height) : std::numeric_limits<coordf_t>::max();
const coordf_t radius_sample_resolution = g_config_tree_support_collision_resolution;
m_tree_support_preview_cache = std::make_shared<TreeSupportData>(*this, xy_distance, max_move_distance, radius_sample_resolution);
m_tree_support_preview_cache = std::make_shared<TreeSupportData>(*this, xy_distance, g_config_tree_support_collision_resolution);
}
return m_tree_support_preview_cache;
@@ -665,7 +658,6 @@ std::shared_ptr<TreeSupportData> PrintObject::alloc_tree_support_preview_cache()
SupportLayer* PrintObject::add_tree_support_layer(int id, coordf_t height, coordf_t print_z, coordf_t slice_z)
{
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();
}
@@ -798,6 +790,7 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "tree_support_branch_distance"
|| opt_key == "tree_support_branch_diameter"
|| opt_key == "tree_support_branch_angle"
|| opt_key == "tree_support_branch_diameter_angle"
|| opt_key == "tree_support_wall_count") {
steps.emplace_back(posSupportMaterial);
} else if (
@@ -895,16 +888,14 @@ bool PrintObject::invalidate_state_by_config_options(
steps.emplace_back(posSlice);
} else if (
opt_key == "seam_position"
|| opt_key == "seam_slope_type"
|| opt_key == "seam_slope_conditional"
|| opt_key == "scarf_angle_threshold"
|| opt_key == "seam_slope_start_height"
|| opt_key == "seam_slope_entire_loop"
|| opt_key == "seam_slope_min_length"
|| opt_key == "seam_slope_steps"
|| opt_key == "seam_slope_inner_walls"
|| opt_key == "seam_gap"
|| opt_key == "wipe_speed"
|| opt_key == "role_base_wipe_speed"
|| opt_key == "support_speed"
|| opt_key == "support_interface_speed"
//1.9.5
@@ -1028,19 +1019,8 @@ void PrintObject::detect_surfaces_type()
// In non-spiral vase mode, go over all layers.
m_layers.size()),
[this, spiral_mode, 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.
// QDS: 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;
// QDS coconut: can't set to stBottom when soluable support is used, as the support may not be actaully generated, e.g. when "on build plate only" option is enabled. See github #3507.
SurfaceType surface_type_bottom_other = 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;
@@ -2576,12 +2556,14 @@ void PrintObject::bridge_over_infill()
const Flow &flow = candidate.region->bridging_flow(frSolidInfill, true);
Polygons area_to_be_bridge = expand(candidate.new_polys, flow.scaled_spacing());
area_to_be_bridge = intersection(area_to_be_bridge, deep_infill_area);
area_to_be_bridge.erase(std::remove_if(area_to_be_bridge.begin(), area_to_be_bridge.end(),
[internal_unsupported_area](const Polygon &p) {
ExPolygons area_to_be_bridge_ex = union_ex(area_to_be_bridge);
area_to_be_bridge_ex.erase(std::remove_if(area_to_be_bridge_ex.begin(), area_to_be_bridge_ex.end(),
[internal_unsupported_area](const ExPolygon &p) {
return intersection({p}, internal_unsupported_area).empty();
}),
area_to_be_bridge.end());
area_to_be_bridge_ex.end());
area_to_be_bridge = to_polygons(area_to_be_bridge_ex);
Polygons limiting_area = union_(area_to_be_bridge, expansion_area);
@@ -3523,90 +3505,7 @@ template void PrintObject::remove_bridges_from_contacts<Polygons>(
SupportNecessaryType PrintObject::is_support_necessary()
{
static const double super_overhang_area_threshold = SQ(scale_(5.0));
const double cantilevel_dist_thresh = scale_(6);
#if 0
double threshold_rad = (m_config.support_threshold_angle.value < EPSILON ? 30 : m_config.support_threshold_angle.value + 1) * M_PI / 180.;
int enforce_support_layers = m_config.enforce_support_layers;
const coordf_t extrusion_width = m_config.line_width.value;
const coordf_t extrusion_width_scaled = scale_(extrusion_width);
float max_bridge_length = scale_(m_config.max_bridge_length.value);
const bool bridge_no_support = max_bridge_length > 0;// config.bridge_no_support.value;
for (size_t layer_nr = enforce_support_layers + 1; layer_nr < this->layer_count(); layer_nr++) {
Layer* layer = m_layers[layer_nr];
Layer* lower_layer = layer->lower_layer;
coordf_t support_offset_scaled = extrusion_width_scaled * 0.9;
ExPolygons lower_layer_offseted = offset_ex(lower_layer->lslices, support_offset_scaled, SUPPORT_SURFACES_OFFSET_PARAMETERS);
// 1. check sharp tail
for (const LayerRegion* layerm : layer->regions()) {
for (const ExPolygon& expoly : layerm->raw_slices) {
// detect sharp tail
if (intersection_ex({ expoly }, lower_layer_offseted).empty())
return SharpTail;
}
}
// 2. check overhang area
ExPolygons super_overhang_expolys = std::move(diff_ex(layer->lslices, lower_layer_offseted));
super_overhang_expolys.erase(std::remove_if(
super_overhang_expolys.begin(),
super_overhang_expolys.end(),
[extrusion_width_scaled](ExPolygon& area) {
return offset_ex(area, -0.1 * extrusion_width_scaled).empty();
}),
super_overhang_expolys.end());
// remove bridge
if (bridge_no_support)
remove_bridges_from_contacts(lower_layer, layer, extrusion_width_scaled, &super_overhang_expolys, max_bridge_length);
Polygons super_overhang_polys = to_polygons(super_overhang_expolys);
super_overhang_polys.erase(std::remove_if(
super_overhang_polys.begin(),
super_overhang_polys.end(),
[extrusion_width_scaled](Polygon& area) {
return offset_ex(area, -0.1 * extrusion_width_scaled).empty();
}),
super_overhang_polys.end());
double super_overhang_area = 0.0;
for (Polygon& poly : super_overhang_polys) {
bool is_ccw = poly.is_counter_clockwise();
double area_ = poly.area();
if (is_ccw) {
if (area_ > super_overhang_area_threshold)
return LargeOverhang;
super_overhang_area += area_;
}
else {
super_overhang_area -= area_;
}
}
//if (super_overhang_area > super_overhang_area_threshold)
// return LargeOverhang;
// 3. check overhang distance
const double distance_threshold_scaled = extrusion_width_scaled * 2;
ExPolygons lower_layer_offseted_2 = offset_ex(lower_layer->lslices, distance_threshold_scaled, SUPPORT_SURFACES_OFFSET_PARAMETERS);
ExPolygons exceed_overhang = std::move(diff_ex(super_overhang_polys, lower_layer_offseted_2));
exceed_overhang.erase(std::remove_if(
exceed_overhang.begin(),
exceed_overhang.end(),
[extrusion_width_scaled](ExPolygon& area) {
// tolerance for 1 extrusion width offset
return offset_ex(area, -0.5 * extrusion_width_scaled).empty();
}),
exceed_overhang.end());
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(true);
@@ -3615,7 +3514,7 @@ SupportNecessaryType PrintObject::is_support_necessary()
return SharpTail;
else if (tree_support.has_cantilever && tree_support.max_cantilever_dist > cantilevel_dist_thresh)
return Cantilever;
#endif
return NoNeedSupp;
}
@@ -3806,7 +3705,7 @@ 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
bool seam, EnforcerBlockerType type, std::vector<Polygons>& out, std::vector<std::pair<Vec3f, Vec3f>>* vertical_points) const
{
for (const ModelVolume* mv : this->model_object()->volumes)
if (mv->is_model_part()) {
@@ -3821,7 +3720,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, [](){});
slice_mesh_slabs(custom_facets, zs_from_layers(this->layers()), this->trafo_centered() * mv->get_matrix(), nullptr, &projected, vertical_points, [](){});
// Merge these projections with the output, layer by layer.
assert(! projected.empty());
assert(out.empty() || out.size() == projected.size());