SLA supports - added parameters for the automatic generation (relative density measure and minimal distance of the points)

This commit is contained in:
Lukas Matena 2019-02-19 16:34:52 +01:00
parent 1bb0af1588
commit eb0fd03861
9 changed files with 54 additions and 59 deletions

View file

@ -2287,12 +2287,13 @@ RENDER_AGAIN:
}
}
else {
//m_imgui->text("Some settings could");
//m_imgui->text("be exposed here...");
m_imgui->text("");
m_imgui->text("");
m_imgui->text("");
/* ImGui::PushItemWidth(50.0f);
m_imgui->text(_(L("Minimal points distance: ")));
ImGui::SameLine();
bool value_changed = ImGui::InputDouble("mm", &m_minimal_point_distance, 0.0f, 0.0f, "%.2f");
m_imgui->text(_(L("Support points density: ")));
ImGui::SameLine();
value_changed |= ImGui::InputDouble("%", &m_density, 0.0f, 0.0f, "%.f");*/
bool generate = m_imgui->button(_(L("Auto-generate points")));
@ -2342,8 +2343,9 @@ RENDER_AGAIN:
force_refresh = true;
}
#endif
ImGui::SameLine();
bool editing_clicked = m_imgui->button("Editing");
m_imgui->text("");
m_imgui->text("");
bool editing_clicked = m_imgui->button(_(L("Manual editing")));
if (editing_clicked) {
editing_mode_reload_cache();
m_editing_mode = true;
@ -2463,9 +2465,13 @@ void GLGizmoSlaSupports::editing_mode_discard_changes()
void GLGizmoSlaSupports::editing_mode_apply_changes()
{
m_model_object->sla_support_points.clear();
for (const std::pair<sla::SupportPoint, bool>& point_and_selection : m_editing_mode_cache)
m_model_object->sla_support_points.push_back(point_and_selection.first);
// If there are no changes, don't touch the front-end. The data in the cache could have been
// taken from the backend and copying them to ModelObject would needlessly invalidate them.
if (m_unsaved_changes) {
m_model_object->sla_support_points.clear();
for (const std::pair<sla::SupportPoint, bool>& point_and_selection : m_editing_mode_cache)
m_model_object->sla_support_points.push_back(point_and_selection.first);
}
m_editing_mode = false;
m_unsaved_changes = false;
}

View file

@ -492,6 +492,8 @@ private:
bool m_lock_unique_islands = false;
bool m_editing_mode = false;
float m_new_point_head_diameter = 0.4f;
double m_minimal_point_distance = 20.;
double m_density = 100.;
std::vector<std::pair<sla::SupportPoint, bool>> m_editing_mode_cache; // a support point and whether it is currently selected
bool m_selection_rectangle_active = false;

View file

@ -457,9 +457,8 @@ const std::vector<std::string>& Preset::sla_print_options()
"support_critical_angle",
"support_max_bridge_length",
"support_object_elevation",
"support_density_at_horizontal",
"support_density_at_45",
"support_minimal_z",
"support_points_density_relative",
"support_points_minimal_distance",
"pad_enable",
"pad_wall_thickness",
"pad_wall_height",

View file

@ -3202,9 +3202,8 @@ void TabSLAPrint::build()
optgroup->append_single_option_line("support_max_bridge_length");
optgroup = page->new_optgroup(_(L("Automatic generation")));
optgroup->append_single_option_line("support_density_at_horizontal");
optgroup->append_single_option_line("support_density_at_45");
optgroup->append_single_option_line("support_minimal_z");
optgroup->append_single_option_line("support_points_density_relative");
optgroup->append_single_option_line("support_points_minimal_distance");
page = add_options_page(_(L("Pad")), "brick.png");
optgroup = page->new_optgroup(_(L("Pad")));