Fix of
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:
parent
e78839d2fc
commit
abcd746774
@ -711,11 +711,10 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
|
||||
} else {
|
||||
// Generate overhang / contact_polygons for non-raft layers.
|
||||
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) {
|
||||
const LayerRegion &layerm = *(*it_layerm);
|
||||
for (LayerRegion *layerm : layer.regions) {
|
||||
// Extrusion width accounts for the roundings of the extrudates.
|
||||
// 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 =
|
||||
(layer_id < this->m_object_config->support_material_enforce_layers.value) ?
|
||||
// Enforce a full possible support, ignore the overhang angle.
|
||||
@ -727,7 +726,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
|
||||
0.5f * fw);
|
||||
// Overhang polygons for this layer and region.
|
||||
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);
|
||||
if (lower_layer_offset == 0.f) {
|
||||
// Support everything.
|
||||
@ -751,7 +750,10 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
|
||||
|
||||
#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);
|
||||
svg.draw(expolys);
|
||||
}
|
||||
@ -763,14 +765,14 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
|
||||
if (true) {
|
||||
Polygons bridged_perimeters;
|
||||
{
|
||||
Flow bridge_flow = layerm.flow(frPerimeter, true);
|
||||
coordf_t nozzle_diameter = m_print_config->nozzle_diameter.get_at(layerm.region()->config.perimeter_extruder-1);
|
||||
Flow bridge_flow = layerm->flow(frPerimeter, true);
|
||||
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);
|
||||
|
||||
// Collect perimeters of this layer.
|
||||
// TODO: split_at_first_point() could split a bridge mid-way
|
||||
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);
|
||||
assert(island != NULL);
|
||||
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
|
||||
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)
|
||||
polygons_append(bridges, surface.expolygon);
|
||||
diff_polygons = diff(diff_polygons, bridges, true);
|
||||
@ -817,11 +819,11 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
|
||||
polygons_append(diff_polygons,
|
||||
intersection(
|
||||
// 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));
|
||||
} else {
|
||||
// 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)
|
||||
|
||||
@ -836,7 +838,10 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
|
||||
|
||||
#ifdef SLIC3R_DEBUG
|
||||
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));
|
||||
#endif /* SLIC3R_DEBUG */
|
||||
|
||||
@ -849,10 +854,12 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
|
||||
// on the other side of the object (if it's very thin).
|
||||
{
|
||||
//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) {
|
||||
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()) {
|
||||
// Trim the inflated contact surfaces by the top surfaces as well.
|
||||
polygons_append(slices_margin_cached, buildplate_covered[layer_id]);
|
||||
|
Loading…
Reference in New Issue
Block a user