Add separate arrangement distance control for SLA mode
This commit is contained in:
parent
3e0ce8a054
commit
8df4d6a170
2 changed files with 39 additions and 14 deletions
|
@ -1105,6 +1105,9 @@ static GLCanvas3D::ArrangeSettings load_arrange_settings()
|
|||
std::string dist_seq_print_str =
|
||||
wxGetApp().app_config->get("arrange", "min_object_distance_seq_print");
|
||||
|
||||
std::string dist_sla_str =
|
||||
wxGetApp().app_config->get("arrange", "min_object_distance_sla");
|
||||
|
||||
std::string en_rot_str =
|
||||
wxGetApp().app_config->get("arrange", "enable_rotation");
|
||||
|
||||
|
@ -1114,6 +1117,9 @@ static GLCanvas3D::ArrangeSettings load_arrange_settings()
|
|||
if (!dist_seq_print_str.empty())
|
||||
settings.distance_seq_print = std::stof(dist_seq_print_str);
|
||||
|
||||
if (!dist_sla_str.empty())
|
||||
settings.distance_sla = std::stof(dist_sla_str);
|
||||
|
||||
if (!en_rot_str.empty())
|
||||
settings.enable_rotation = (en_rot_str == "1" || en_rot_str == "yes");
|
||||
|
||||
|
@ -3911,25 +3917,47 @@ bool GLCanvas3D::_render_arrange_menu(float pos_x)
|
|||
ArrangeSettings settings = m_arrange_settings;
|
||||
|
||||
auto &appcfg = wxGetApp().app_config;
|
||||
PrinterTechnology ptech = m_process->current_printer_technology();
|
||||
|
||||
bool settings_changed = false;
|
||||
bool is_seq_print = m_config->opt_bool("complete_objects");
|
||||
float *dist_val = nullptr;
|
||||
float *dist_val_out = nullptr;
|
||||
float dist_min = 0.f;
|
||||
std::string dist_key;
|
||||
|
||||
if (ptech == ptSLA) {
|
||||
dist_val = &settings.distance_sla;
|
||||
dist_val_out = &m_arrange_settings.distance_sla;
|
||||
dist_min = 0.f;
|
||||
dist_key = "min_object_distance_sla";
|
||||
} else if (ptech == ptFFF) {
|
||||
auto co_opt = m_config->option<ConfigOptionBool>("complete_objects");
|
||||
if (co_opt && co_opt->value) {
|
||||
dist_val = &settings.distance_seq_print;
|
||||
dist_val_out = &m_arrange_settings.distance_seq_print;
|
||||
dist_min = float(min_object_distance(*m_config));
|
||||
dist_key = "min_object_distance_seq_print";
|
||||
} else {
|
||||
dist_val = &settings.distance;
|
||||
dist_val_out = &m_arrange_settings.distance;
|
||||
dist_min = 0.f;
|
||||
dist_key = "min_object_distance";
|
||||
}
|
||||
}
|
||||
|
||||
imgui->text(_L("Use CTRL+left mouse key to enter text edit mode:"));
|
||||
|
||||
float &dist_val = is_seq_print ? settings.distance_seq_print : settings.distance;
|
||||
float dist_min = is_seq_print ? float(min_object_distance(*m_config)) : 0.f;
|
||||
dist_val = std::max(dist_min, dist_val);
|
||||
|
||||
if (imgui->slider_float(_L("Clearance size"), &dist_val, dist_min, 100.0f, "%5.2f")) {
|
||||
is_seq_print ? m_arrange_settings.distance_seq_print = dist_val :
|
||||
m_arrange_settings.distance = dist_val;
|
||||
*dist_val = std::max(dist_min, *dist_val);
|
||||
|
||||
if (imgui->slider_float(_L("Clearance size"), dist_val, dist_min, 100.0f, "%5.2f")) {
|
||||
*dist_val_out = *dist_val;
|
||||
appcfg->set("arrange", dist_key.c_str(), std::to_string(*dist_val_out));
|
||||
settings_changed = true;
|
||||
}
|
||||
|
||||
if (imgui->checkbox(_L("Enable rotations (slow)"), settings.enable_rotation)) {
|
||||
m_arrange_settings.enable_rotation = settings.enable_rotation;
|
||||
appcfg->set("arrange", "enable_rotation", m_arrange_settings.enable_rotation? "1" : "0");
|
||||
settings_changed = true;
|
||||
}
|
||||
|
||||
|
@ -3937,13 +3965,9 @@ bool GLCanvas3D::_render_arrange_menu(float pos_x)
|
|||
|
||||
if (imgui->button(_L("Reset"))) {
|
||||
m_arrange_settings = ArrangeSettings{};
|
||||
settings_changed = true;
|
||||
}
|
||||
|
||||
if (settings_changed) {
|
||||
appcfg->set("arrange", "min_object_distance", std::to_string(m_arrange_settings.distance));
|
||||
appcfg->set("arrange", "min_object_distance_seq_print", std::to_string(m_arrange_settings.distance_seq_print));
|
||||
appcfg->set("arrange", dist_key.c_str(), std::to_string(*dist_val_out));
|
||||
appcfg->set("arrange", "enable_rotation", m_arrange_settings.enable_rotation? "1" : "0");
|
||||
settings_changed = true;
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
|
|
@ -389,6 +389,7 @@ public:
|
|||
{
|
||||
float distance = 6.;
|
||||
float distance_seq_print = 6.; // Used when sequential print is ON
|
||||
float distance_sla = 6.;
|
||||
float accuracy = 0.65f; // Unused currently
|
||||
bool enable_rotation = false;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue