Cut WIP: Suppress use connectors for SLA mode

This commit is contained in:
YuSanka 2022-07-27 15:21:37 +02:00
parent 27f7a8da0f
commit 05c22604fb
4 changed files with 27 additions and 6 deletions

View File

@ -2682,6 +2682,14 @@ bool model_has_multi_part_objects(const Model &model)
return false; return false;
} }
bool model_has_connectors(const Model &model)
{
for (const ModelObject *model_object : model.objects)
if (!model_object->cut_connectors.empty())
return true;
return false;
}
bool model_has_advanced_features(const Model &model) bool model_has_advanced_features(const Model &model)
{ {
auto config_is_advanced = [](const ModelConfig &config) { auto config_is_advanced = [](const ModelConfig &config) {

View File

@ -1338,6 +1338,8 @@ extern bool model_mmu_segmentation_data_changed(const ModelObject& mo, const Mod
// If the model has multi-part objects, then it is currently not supported by the SLA mode. // If the model has multi-part objects, then it is currently not supported by the SLA mode.
// Either the model cannot be loaded, or a SLA printer has to be activated. // Either the model cannot be loaded, or a SLA printer has to be activated.
bool model_has_multi_part_objects(const Model &model); bool model_has_multi_part_objects(const Model &model);
// If the model has objects with cut connectrs, then it is currently not supported by the SLA mode.
bool model_has_connectors(const Model& model);
// If the model has advanced features, then it cannot be processed in simple mode. // If the model has advanced features, then it cannot be processed in simple mode.
bool model_has_advanced_features(const Model &model); bool model_has_advanced_features(const Model &model);

View File

@ -2869,6 +2869,13 @@ bool GUI_App::may_switch_to_SLA_preset(const wxString& caption)
caption); caption);
return false; return false;
} }
if (model_has_connectors(model())) {
show_info(nullptr,
_L("SLA technology doesn't support cut with connectors") + "\n\n" +
_L("Please check your object list before preset changing."),
caption);
return false;
}
return true; return true;
} }

View File

@ -1176,6 +1176,7 @@ void GLGizmoCut3D::on_render_input_window(float x, float y, float bottom_limit)
bool cut_clicked = false; bool cut_clicked = false;
bool revert_move{ false }; bool revert_move{ false };
bool revert_rotation{ false }; bool revert_rotation{ false };
bool fff_printer = wxGetApp().plater()->printer_technology() == ptFFF;
if (! m_connectors_editing) { if (! m_connectors_editing) {
if (m_mode == size_t(CutMode::cutPlanar)) { if (m_mode == size_t(CutMode::cutPlanar)) {
@ -1263,6 +1264,7 @@ void GLGizmoCut3D::on_render_input_window(float x, float y, float bottom_limit)
m_imgui->disabled_end(); m_imgui->disabled_end();
} }
if (fff_printer) {
ImGui::Separator(); ImGui::Separator();
m_imgui->disabled_begin(!m_keep_upper || !m_keep_lower); m_imgui->disabled_begin(!m_keep_upper || !m_keep_lower);
@ -1270,6 +1272,7 @@ void GLGizmoCut3D::on_render_input_window(float x, float y, float bottom_limit)
m_connectors_editing = true; m_connectors_editing = true;
m_imgui->disabled_end(); m_imgui->disabled_end();
} }
}
else { // connectors mode else { // connectors mode
if (m_imgui->button("? " + (m_show_shortcuts ? wxString(ImGui::CollapseBtn) : wxString(ImGui::ExpandBtn)))) if (m_imgui->button("? " + (m_show_shortcuts ? wxString(ImGui::CollapseBtn) : wxString(ImGui::ExpandBtn))))
m_show_shortcuts = !m_show_shortcuts; m_show_shortcuts = !m_show_shortcuts;
@ -1361,6 +1364,7 @@ void GLGizmoCut3D::on_render_input_window(float x, float y, float bottom_limit)
ImGui::Separator(); ImGui::Separator();
if (fff_printer)
m_imgui->text(m_has_invalid_connector ? wxString(ImGui::WarningMarkerSmall) + _L("Invalid connectors detected.") : wxString()); m_imgui->text(m_has_invalid_connector ? wxString(ImGui::WarningMarkerSmall) + _L("Invalid connectors detected.") : wxString());
if (!m_connectors_editing) { if (!m_connectors_editing) {
m_imgui->disabled_begin(!can_perform_cut()); m_imgui->disabled_begin(!can_perform_cut());