Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLukas Matena <lukasmatena@seznam.cz>2020-04-27 18:43:34 +0300
committerLukas Matena <lukasmatena@seznam.cz>2020-04-27 18:45:55 +0300
commit2bd524849ad8aeeb8fb96f29c9ef9d28dfeaa727 (patch)
treea75407e4237dc25e768816d3c44996b84f05f227 /src
parent9fdc54bfffbcb72241a0cbaa5960ed7d15f36c0b (diff)
Custom support blockers are now working
Diffstat (limited to 'src')
-rw-r--r--src/libslic3r/PrintObject.cpp7
-rw-r--r--src/libslic3r/SupportMaterial.cpp23
2 files changed, 18 insertions, 12 deletions
diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp
index 1370b4d0f..34b17c7bf 100644
--- a/src/libslic3r/PrintObject.cpp
+++ b/src/libslic3r/PrintObject.cpp
@@ -2686,7 +2686,7 @@ void PrintObject::project_and_append_custom_supports(
// Iterate over all triangles.
tbb::parallel_for(
- tbb::blocked_range<size_t>(0, custom_facets.size() - 1),
+ tbb::blocked_range<size_t>(0, custom_facets.size()),
[&](const tbb::blocked_range<size_t>& range) {
for (size_t idx = range.begin(); idx < range.end(); ++ idx) {
@@ -2799,10 +2799,9 @@ void PrintObject::project_and_append_custom_supports(
// Now append the collected polygons to respective layers.
for (auto& trg : projections_of_triangles) {
int layer_id = trg.first_layer_id;
- if (layer_id == 0)
- continue;
+
for (const LightPolygon& poly : trg.polygons) {
- expolys[layer_id-1].emplace_back(std::move(poly.pts));
+ expolys[layer_id].emplace_back(std::move(poly.pts));
++layer_id;
}
}
diff --git a/src/libslic3r/SupportMaterial.cpp b/src/libslic3r/SupportMaterial.cpp
index 647c00ec2..6cde050cf 100644
--- a/src/libslic3r/SupportMaterial.cpp
+++ b/src/libslic3r/SupportMaterial.cpp
@@ -1101,10 +1101,10 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
if (! enforcers.empty()) {
// Apply the "support enforcers".
//FIXME add the "enforcers" to the sparse support regions only.
- const ExPolygons &enforcer = enforcers[layer_id - 1];
+ const ExPolygons &enforcer = enforcers[layer_id];
if (! enforcer.empty()) {
// Enforce supports (as if with 90 degrees of slope) for the regions covered by the enforcer meshes.
- Polygons new_contacts = diff(intersection(layerm_polygons, to_polygons(enforcer)),
+ Polygons new_contacts = diff(intersection(layerm_polygons, to_polygons(std::move(enforcer))),
offset(lower_layer_polygons, 0.05f * fw, SUPPORT_SURFACES_OFFSET_PARAMETERS));
if (! new_contacts.empty()) {
if (diff_polygons.empty())
@@ -1115,19 +1115,26 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
}
}
}
- // Apply the "support blockers".
- if (! diff_polygons.empty() && ! blockers.empty() && ! blockers[layer_id].empty()) {
- // Enforce supports (as if with 90 degrees of slope) for the regions covered by the enforcer meshes.
- diff_polygons = diff(diff_polygons, to_polygons(blockers[layer_id]));
- }
+
if (diff_polygons.empty())
continue;
+ // Apply the "support blockers".
+ if (! blockers.empty() && ! blockers[layer_id].empty()) {
+ // Expand the blocker a bit. Custom blockers produce strips
+ // spanning just the projection between the two slices.
+ // Subtracting them as they are may leave unwanted narrow
+ // residues of diff_polygons that would then be supported.
+ diff_polygons = diff(diff_polygons,
+ offset(union_(to_polygons(std::move(blockers[layer_id]))),
+ 1000.*SCALED_EPSILON));
+ }
+
#ifdef SLIC3R_DEBUG
{
::Slic3r::SVG svg(debug_out_path("support-top-contacts-raw-run%d-layer%d-region%d.svg",
iRun, layer_id,
- std::find_if(layer.regions.begin(), layer.regions.end(), [layerm](const LayerRegion* other){return other == layerm;}) - layer.regions.begin()),
+ std::find_if(layer.regions.begin(), layer.regions.end(), [layerm](const LayerRegion* other){return other == layerm;}) - layer.regions.begin()),
get_extents(diff_polygons));
Slic3r::ExPolygons expolys = union_ex(diff_polygons, false);
svg.draw(expolys);