Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the issue of avoiding excessive invalid computations that can cau… #6757

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/libslic3r/Support/TreeModelVolumes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,8 @@ void TreeModelVolumes::calculateCollision(const coord_t radius, const LayerIndex
if (const std::vector<Polygons> &outlines = m_layer_outlines[outline_idx].second; ! outlines.empty()) {
const TreeSupportMeshGroupSettings &settings = m_layer_outlines[outline_idx].first;
const coord_t layer_height = settings.layer_height;
const int z_distance_bottom_layers = int(round(double(settings.support_bottom_distance) / double(layer_height)));
const int z_distance_top_layers = int(round(double(settings.support_top_distance) / double(layer_height)));
const int z_distance_bottom_layers = int(round(double(settings.support_bottom_distance) / double(layer_height))) > 10 ? 10 : int(round(double(settings.support_bottom_distance) / double(layer_height)));
const int z_distance_top_layers = int(round(double(settings.support_top_distance) / double(layer_height))) > 10 ? 10 : int(round(double(settings.support_top_distance) / double(layer_height)));
const coord_t xy_distance = outline_idx == m_current_outline_idx ? m_current_min_xy_dist :
// technically this causes collision for the normal xy_distance to be larger by m_current_min_xy_dist_delta for all
// not currently processing meshes as this delta will be added at request time.
Expand Down
14 changes: 12 additions & 2 deletions src/libslic3r/SupportMaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3322,16 +3322,26 @@ void PrintObjectSupportMaterial::trim_support_layers_by_object(
// BOOST_LOG_TRIVIAL(trace) << "Support generator - trim_support_layers_by_object - trimmming non-empty layer " << idx_layer << " of " << nonempty_layers.size();
assert(! support_layer.polygons.empty() && support_layer.print_z >= m_slicing_params.raft_contact_top_z + EPSILON);
// Find the overlapping object layers including the extra above / below gap.
coordf_t z_threshold = support_layer.bottom_print_z() - gap_extra_below + EPSILON;
double layer_height = 0.f;
if(object.layers().size() > 0){
const Layer &object_layer = *object.layers()[0];
layer_height = object_layer.height;
}
double g_e_below = gap_extra_below;
if(g_e_below > layer_height){
g_e_below = layer_height;
}
coordf_t z_threshold = support_layer.bottom_print_z() - g_e_below + EPSILON;
idx_object_layer_overlapping = Layer::idx_higher_or_equal(
object.layers().begin(), object.layers().end(), idx_object_layer_overlapping,
[z_threshold](const Layer *layer){ return layer->print_z >= z_threshold; });
// Collect all the object layers intersecting with this layer.
Polygons polygons_trimming;
size_t i = idx_object_layer_overlapping;
double d_gap_extra_above = gap_extra_above > 2*layer_height ? 2*layer_height : gap_extra_above;
for (; i < object.layers().size(); ++ i) {
const Layer &object_layer = *object.layers()[i];
if (object_layer.bottom_z() > support_layer.print_z + gap_extra_above - EPSILON)
if (object_layer.bottom_z() > support_layer.print_z + d_gap_extra_above - EPSILON)
break;

bool is_overlap = is_layers_overlap(support_layer, object_layer);
Expand Down