ENABLE_ALLOW_NEGATIVE_Z -> Ensure objects on bed when switching to SLA printer

This commit is contained in:
enricoturri1966 2021-05-07 15:08:07 +02:00
parent ff632a9ff2
commit 89da02734e
2 changed files with 14 additions and 6 deletions

View File

@ -1945,7 +1945,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
m_reload_delayed = !m_canvas->IsShown() && !refresh_immediately && !force_full_scene_refresh; m_reload_delayed = !m_canvas->IsShown() && !refresh_immediately && !force_full_scene_refresh;
PrinterTechnology printer_technology = m_process->current_printer_technology(); PrinterTechnology printer_technology = current_printer_technology();
int volume_idx_wipe_tower_old = -1; int volume_idx_wipe_tower_old = -1;
// Release invalidated volumes to conserve GPU memory in case of delayed refresh (see m_reload_delayed). // Release invalidated volumes to conserve GPU memory in case of delayed refresh (see m_reload_delayed).
@ -3572,7 +3572,7 @@ void GLCanvas3D::do_move(const std::string& snapshot_type)
#if ENABLE_ALLOW_NEGATIVE_Z #if ENABLE_ALLOW_NEGATIVE_Z
double shift_z = m->get_instance_min_z(i.second); double shift_z = m->get_instance_min_z(i.second);
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA #if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
if (m_process->current_printer_technology() == ptSLA || shift_z > 0.0) { if (current_printer_technology() == ptSLA || shift_z > 0.0) {
#else #else
if (shift_z > 0.0) { if (shift_z > 0.0) {
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA #endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
@ -3919,7 +3919,7 @@ void GLCanvas3D::update_tooltip_for_settings_item_in_main_toolbar()
{ {
std::string new_tooltip = _u8L("Switch to Settings") + std::string new_tooltip = _u8L("Switch to Settings") +
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "2] - " + _u8L("Print Settings Tab") + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "2] - " + _u8L("Print Settings Tab") +
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "3] - " + (m_process->current_printer_technology() == ptFFF ? _u8L("Filament Settings Tab") : _u8L("Material Settings Tab")) + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "3] - " + (current_printer_technology() == ptFFF ? _u8L("Filament Settings Tab") : _u8L("Material Settings Tab")) +
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab") ; "\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab") ;
m_main_toolbar.set_tooltip(get_main_toolbar_item_id("settings"), new_tooltip); m_main_toolbar.set_tooltip(get_main_toolbar_item_id("settings"), new_tooltip);
@ -4073,7 +4073,7 @@ bool GLCanvas3D::_render_arrange_menu(float pos_x)
ArrangeSettings &settings_out = get_arrange_settings(); ArrangeSettings &settings_out = get_arrange_settings();
auto &appcfg = wxGetApp().app_config; auto &appcfg = wxGetApp().app_config;
PrinterTechnology ptech = m_process->current_printer_technology(); PrinterTechnology ptech = current_printer_technology();
bool settings_changed = false; bool settings_changed = false;
float dist_min = 0.f; float dist_min = 0.f;
@ -4640,7 +4640,7 @@ bool GLCanvas3D::_init_main_toolbar()
item.name = "settings"; item.name = "settings";
item.icon_filename = "settings.svg"; item.icon_filename = "settings.svg";
item.tooltip = _u8L("Switch to Settings") + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "2] - " + _u8L("Print Settings Tab") + item.tooltip = _u8L("Switch to Settings") + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "2] - " + _u8L("Print Settings Tab") +
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "3] - " + (m_process->current_printer_technology() == ptFFF ? _u8L("Filament Settings Tab") : _u8L("Material Settings Tab")) + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "3] - " + (current_printer_technology() == ptFFF ? _u8L("Filament Settings Tab") : _u8L("Material Settings Tab")) +
"\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab") ; "\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab") ;
item.sprite_id = 10; item.sprite_id = 10;
item.enabling_callback = GLToolbarItem::Default_Enabling_Callback; item.enabling_callback = GLToolbarItem::Default_Enabling_Callback;
@ -4682,7 +4682,7 @@ bool GLCanvas3D::_init_main_toolbar()
item.sprite_id = 12; item.sprite_id = 12;
item.left.action_callback = [this]() { if (m_canvas != nullptr) wxPostEvent(m_canvas, SimpleEvent(EVT_GLTOOLBAR_LAYERSEDITING)); }; item.left.action_callback = [this]() { if (m_canvas != nullptr) wxPostEvent(m_canvas, SimpleEvent(EVT_GLTOOLBAR_LAYERSEDITING)); };
item.visibility_callback = [this]()->bool { item.visibility_callback = [this]()->bool {
bool res = m_process->current_printer_technology() == ptFFF; bool res = current_printer_technology() == ptFFF;
// turns off if changing printer technology // turns off if changing printer technology
if (!res && m_main_toolbar.is_item_visible("layersediting") && m_main_toolbar.is_item_pressed("layersediting")) if (!res && m_main_toolbar.is_item_visible("layersediting") && m_main_toolbar.is_item_pressed("layersediting"))
force_main_toolbar_left_action(get_main_toolbar_item_id("layersediting")); force_main_toolbar_left_action(get_main_toolbar_item_id("layersediting"));

View File

@ -5796,6 +5796,14 @@ bool Plater::set_printer_technology(PrinterTechnology printer_technology)
//FIXME for SLA synchronize //FIXME for SLA synchronize
//p->background_process.apply(Model)! //p->background_process.apply(Model)!
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
if (printer_technology == ptSLA) {
for (ModelObject* model_object : p->model.objects) {
model_object->ensure_on_bed();
}
}
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
p->label_btn_export = printer_technology == ptFFF ? L("Export G-code") : L("Export"); p->label_btn_export = printer_technology == ptFFF ? L("Export G-code") : L("Export");
p->label_btn_send = printer_technology == ptFFF ? L("Send G-code") : L("Send to printer"); p->label_btn_send = printer_technology == ptFFF ? L("Send G-code") : L("Send to printer");