Overhang threshold not utilized after 1.34.1
https://github.com/prusa3d/Slic3r/issues/360

"Overhang threshold" and "Enforce support" don't work
https://github.com/prusa3d/Slic3r/issues/273
This commit is contained in:
bubnikv 2017-07-07 10:45:39 +02:00
parent e78839d2fc
commit abcd746774

View File

@ -711,11 +711,10 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
} else { } else {
// Generate overhang / contact_polygons for non-raft layers. // Generate overhang / contact_polygons for non-raft layers.
const Layer &lower_layer = *object.layers[layer_id-1]; const Layer &lower_layer = *object.layers[layer_id-1];
for (LayerRegionPtrs::const_iterator it_layerm = layer.regions.begin(); it_layerm != layer.regions.end(); ++ it_layerm) { for (LayerRegion *layerm : layer.regions) {
const LayerRegion &layerm = *(*it_layerm);
// Extrusion width accounts for the roundings of the extrudates. // Extrusion width accounts for the roundings of the extrudates.
// It is the maximum widh of the extrudate. // It is the maximum widh of the extrudate.
float fw = float(layerm.flow(frExternalPerimeter).scaled_width()); float fw = float(layerm->flow(frExternalPerimeter).scaled_width());
float lower_layer_offset = float lower_layer_offset =
(layer_id < this->m_object_config->support_material_enforce_layers.value) ? (layer_id < this->m_object_config->support_material_enforce_layers.value) ?
// Enforce a full possible support, ignore the overhang angle. // Enforce a full possible support, ignore the overhang angle.
@ -727,7 +726,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
0.5f * fw); 0.5f * fw);
// Overhang polygons for this layer and region. // Overhang polygons for this layer and region.
Polygons diff_polygons; Polygons diff_polygons;
Polygons layerm_polygons = to_polygons(layerm.slices); Polygons layerm_polygons = to_polygons(layerm->slices);
Polygons lower_layer_polygons = to_polygons(lower_layer.slices.expolygons); Polygons lower_layer_polygons = to_polygons(lower_layer.slices.expolygons);
if (lower_layer_offset == 0.f) { if (lower_layer_offset == 0.f) {
// Support everything. // Support everything.
@ -751,7 +750,10 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
#ifdef SLIC3R_DEBUG #ifdef SLIC3R_DEBUG
{ {
::Slic3r::SVG svg(debug_out_path("support-top-contacts-raw-run%d-layer%d-region%d.svg", iRun, layer_id, it_layerm - layer.regions.begin()), get_extents(diff_polygons)); ::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()),
get_extents(diff_polygons));
Slic3r::ExPolygons expolys = union_ex(diff_polygons, false); Slic3r::ExPolygons expolys = union_ex(diff_polygons, false);
svg.draw(expolys); svg.draw(expolys);
} }
@ -763,14 +765,14 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
if (true) { if (true) {
Polygons bridged_perimeters; Polygons bridged_perimeters;
{ {
Flow bridge_flow = layerm.flow(frPerimeter, true); Flow bridge_flow = layerm->flow(frPerimeter, true);
coordf_t nozzle_diameter = m_print_config->nozzle_diameter.get_at(layerm.region()->config.perimeter_extruder-1); coordf_t nozzle_diameter = m_print_config->nozzle_diameter.get_at(layerm->region()->config.perimeter_extruder-1);
Polygons lower_grown_slices = offset(lower_layer_polygons, 0.5f*float(scale_(nozzle_diameter)), SUPPORT_SURFACES_OFFSET_PARAMETERS); Polygons lower_grown_slices = offset(lower_layer_polygons, 0.5f*float(scale_(nozzle_diameter)), SUPPORT_SURFACES_OFFSET_PARAMETERS);
// Collect perimeters of this layer. // Collect perimeters of this layer.
// TODO: split_at_first_point() could split a bridge mid-way // TODO: split_at_first_point() could split a bridge mid-way
Polylines overhang_perimeters; Polylines overhang_perimeters;
for (ExtrusionEntity* extrusion_entity : layerm.perimeters.entities) { for (ExtrusionEntity* extrusion_entity : layerm->perimeters.entities) {
const ExtrusionEntityCollection *island = dynamic_cast<ExtrusionEntityCollection*>(extrusion_entity); const ExtrusionEntityCollection *island = dynamic_cast<ExtrusionEntityCollection*>(extrusion_entity);
assert(island != NULL); assert(island != NULL);
for (size_t i = 0; i < island->entities.size(); ++ i) { for (size_t i = 0; i < island->entities.size(); ++ i) {
@ -809,7 +811,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
} }
// remove the entire bridges and only support the unsupported edges // remove the entire bridges and only support the unsupported edges
Polygons bridges; Polygons bridges;
for (const Surface &surface : layerm.fill_surfaces.surfaces) for (const Surface &surface : layerm->fill_surfaces.surfaces)
if (surface.surface_type == stBottomBridge && surface.bridge_angle != -1) if (surface.surface_type == stBottomBridge && surface.bridge_angle != -1)
polygons_append(bridges, surface.expolygon); polygons_append(bridges, surface.expolygon);
diff_polygons = diff(diff_polygons, bridges, true); diff_polygons = diff(diff_polygons, bridges, true);
@ -817,11 +819,11 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
polygons_append(diff_polygons, polygons_append(diff_polygons,
intersection( intersection(
// Offset unsupported edges into polygons. // Offset unsupported edges into polygons.
offset(layerm.unsupported_bridge_edges.polylines, scale_(SUPPORT_MATERIAL_MARGIN), SUPPORT_SURFACES_OFFSET_PARAMETERS), offset(layerm->unsupported_bridge_edges.polylines, scale_(SUPPORT_MATERIAL_MARGIN), SUPPORT_SURFACES_OFFSET_PARAMETERS),
bridges)); bridges));
} else { } else {
// just remove bridged areas // just remove bridged areas
diff_polygons = diff(diff_polygons, layerm.bridged, true); diff_polygons = diff(diff_polygons, layerm->bridged, true);
} }
} // if (m_objconfig->dont_support_bridges) } // if (m_objconfig->dont_support_bridges)
@ -836,7 +838,10 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
#ifdef SLIC3R_DEBUG #ifdef SLIC3R_DEBUG
Slic3r::SVG::export_expolygons( Slic3r::SVG::export_expolygons(
debug_out_path("support-top-contacts-filtered-run%d-layer%d-region%d-z%f.svg", iRun, layer_id, it_layerm - layer.regions.begin(), layer.print_z), debug_out_path("support-top-contacts-filtered-run%d-layer%d-region%d-z%f.svg",
iRun, layer_id,
std::find_if(layer.regions.begin(), layer.regions.end(), [layerm](const LayerRegion* other){return other == layerm;}) - layer.regions.begin(),
layer.print_z),
union_ex(diff_polygons, false)); union_ex(diff_polygons, false));
#endif /* SLIC3R_DEBUG */ #endif /* SLIC3R_DEBUG */
@ -849,10 +854,12 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
// on the other side of the object (if it's very thin). // on the other side of the object (if it's very thin).
{ {
//FIMXE 1) Make the offset configurable, 2) Make the Z span configurable. //FIMXE 1) Make the offset configurable, 2) Make the Z span configurable.
float slices_margin_offset = float(scale_(m_gap_xy)); float slices_margin_offset = std::min(lower_layer_offset, float(scale_(m_gap_xy)));
if (slices_margin_cached_offset != slices_margin_offset) { if (slices_margin_cached_offset != slices_margin_offset) {
slices_margin_cached_offset = slices_margin_offset; slices_margin_cached_offset = slices_margin_offset;
slices_margin_cached = offset(lower_layer.slices.expolygons, slices_margin_offset, SUPPORT_SURFACES_OFFSET_PARAMETERS); slices_margin_cached = (slices_margin_offset == 0.f) ?
to_polygons(lower_layer.slices.expolygons) :
offset(lower_layer.slices.expolygons, slices_margin_offset, SUPPORT_SURFACES_OFFSET_PARAMETERS);
if (! buildplate_covered.empty()) { if (! buildplate_covered.empty()) {
// Trim the inflated contact surfaces by the top surfaces as well. // Trim the inflated contact surfaces by the top surfaces as well.
polygons_append(slices_margin_cached, buildplate_covered[layer_id]); polygons_append(slices_margin_cached, buildplate_covered[layer_id]);