mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 03:45:59 +08:00
Remove duplication of permanent points
This commit is contained in:
parent
34296a9d62
commit
8e956f68c3
@ -1118,7 +1118,9 @@ void copy_permanent_supports(NearPoints& near_points, const PermanentSupports& s
|
||||
/* SupportPoint */ *support.point_it,
|
||||
/* position_on_layer */ support.layer_position,
|
||||
/* radius_curve_index */ 0, // before support point - earlier influence on point distribution
|
||||
/* current_radius */ calc_influence_radius(fabs(support.point_it->pos.z() - print_z), config)
|
||||
/* current_radius */ calc_influence_radius(fabs(support.point_it->pos.z() - print_z), config),
|
||||
/* active_in_part */ true,
|
||||
/* is_permanent */ true
|
||||
});
|
||||
|
||||
// NOTE: increment index globaly
|
||||
@ -1192,6 +1194,7 @@ LayerSupportPoints Slic3r::sla::generate_support_points(
|
||||
NearPoints near_points = create_near_points(prev_layer_parts, part, prev_grids);
|
||||
remove_supports_out_of_part(near_points, part, config);
|
||||
if (!part.peninsulas.empty()) {
|
||||
// only get copy of points do not modify permanent_index
|
||||
Points permanent = get_permanents(permanent_supports, permanent_index, layer_id, part_id);
|
||||
support_peninsulas(part.peninsulas, near_points, layer.print_z, permanent, config);
|
||||
}
|
||||
@ -1209,6 +1212,10 @@ LayerSupportPoints Slic3r::sla::generate_support_points(
|
||||
if (old_status_int < status_int)
|
||||
statusfn(status_int);
|
||||
}
|
||||
// Remove permanent supports from result
|
||||
// To preserve permanent 3d position it is necessary to append points after move_on_mesh_surface
|
||||
result.erase(std::remove_if(result.begin(), result.end(),
|
||||
[](const LayerSupportPoint &p) { return p.is_permanent; }), result.end());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -126,6 +126,9 @@ struct LayerSupportPoint: public SupportPoint
|
||||
// Flagged false when no part on layer in Radius 'r' around support point
|
||||
// Tool to support overlapped overhang area multiple times
|
||||
bool active_in_part = true;
|
||||
|
||||
// When true support point position is not generated by algorithm
|
||||
bool is_permanent = false;
|
||||
};
|
||||
using LayerSupportPoints = std::vector<LayerSupportPoint>;
|
||||
|
||||
|
@ -725,7 +725,8 @@ void SLAPrint::Steps::support_points(SLAPrintObject &po)
|
||||
SupportPoints support_points =
|
||||
move_on_mesh_surface(layer_support_points, emesh, allowed_move, cancel);
|
||||
|
||||
// Naive implementation only append permanent supports to the result
|
||||
// Generator count with permanent support positions but do not convert to LayerSupportPoints.
|
||||
// To preserve permanent 3d position it is necessary to append points after move_on_mesh_surface
|
||||
support_points.insert(support_points.end(),
|
||||
data.permanent_supports.begin(), data.permanent_supports.end());
|
||||
|
||||
|
@ -1362,19 +1362,10 @@ void GLGizmoSlaSupports::get_data_from_backend()
|
||||
|
||||
void GLGizmoSlaSupports::auto_generate()
|
||||
{
|
||||
//wxMessageDialog dlg(GUI::wxGetApp().plater(),
|
||||
MessageDialog dlg(GUI::wxGetApp().plater(),
|
||||
_L("Autogeneration with manually edited points is inperfect but preserve wanted postion of supports.") + "\n\n" +
|
||||
_L("Do you want to remove manually edited points?") + "\n",
|
||||
_L("Warning"), wxICON_WARNING | wxYES | wxNO);
|
||||
ModelObject* mo = m_c->selection_info()->model_object();
|
||||
if (mo->sla_points_status == sla::PointsStatus::UserModified &&
|
||||
dlg.ShowModal() == wxID_YES) {
|
||||
mo->sla_support_points.clear();
|
||||
}
|
||||
Plater::TakeSnapshot snapshot(wxGetApp().plater(), _L("Autogenerate support points"));
|
||||
wxGetApp().CallAfter([this]() { reslice_until_step(
|
||||
m_show_support_structure ? slaposPad : slaposSupportPoints); });
|
||||
ModelObject* mo = m_c->selection_info()->model_object();
|
||||
mo->sla_points_status = sla::PointsStatus::Generating;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user