Add a new handy model: Orca string hell (#3892)

* add string hell

* tweak message
This commit is contained in:
SoftFever 2024-01-30 08:30:36 +08:00 committed by GitHub
parent da349202d2
commit d1eea4c677
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 52 additions and 20 deletions

View file

@ -2,6 +2,7 @@
///|/
///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
///|/
#include "libslic3r/Config.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/PresetBundle.hpp"
#include "libslic3r/Model.hpp"
@ -23,8 +24,11 @@
#include "Gizmos/GLGizmoSVG.hpp"
#include <boost/algorithm/string.hpp>
#include "slic3r/GUI/Tab.hpp"
#include "slic3r/Utils/FixModelByWin10.hpp"
#include "ParamsPanel.hpp"
#include "MsgDialog.hpp"
#include "wx/utils.h"
namespace Slic3r
{
@ -518,28 +522,56 @@ wxMenu* MenuFactory::append_submenu_add_handy_model(wxMenu* menu, ModelVolumeTyp
auto sub_menu = new wxMenu;
for (auto &item : {L("Orca Cube"), L("3DBenchy"), L("Autodesk FDM Test"),
L("Voron Cube"), L("Stanford Bunny")}) {
L("Voron Cube"), L("Stanford Bunny"), L("Orca String Hell") }) {
append_menu_item(
sub_menu, wxID_ANY, _(item), "",
[type, item](wxCommandEvent &) {
std::vector<boost::filesystem::path> input_files;
std::string file_name = item;
if (file_name == L("Orca Cube"))
file_name = "OrcaCube_v2.3mf";
else if (file_name == L("3DBenchy"))
file_name = "3DBenchy.stl";
else if (file_name == L("Autodesk FDM Test"))
file_name = "ksr_fdmtest_v4.stl";
else if (file_name == L("Voron Cube"))
file_name = "Voron_Design_Cube_v7.stl";
else if (file_name == L("Stanford Bunny"))
file_name = "Stanford_Bunny.stl";
else
return;
input_files.push_back(
(boost::filesystem::path(Slic3r::resources_dir()) /
"handy_models" / file_name));
plater()->load_files(input_files, LoadStrategy::LoadModel);
[type, item](wxCommandEvent&) {
std::vector<boost::filesystem::path> input_files;
bool is_stringhell = false;
std::string file_name = item;
if (file_name == L("Orca Cube"))
file_name = "OrcaCube_v2.3mf";
else if (file_name == L("3DBenchy"))
file_name = "3DBenchy.stl";
else if (file_name == L("Autodesk FDM Test"))
file_name = "ksr_fdmtest_v4.stl";
else if (file_name == L("Voron Cube"))
file_name = "Voron_Design_Cube_v7.stl";
else if (file_name == L("Stanford Bunny"))
file_name = "Stanford_Bunny.stl";
else if (file_name == L("Orca String Hell")) {
file_name = "Orca_stringhell.stl";
is_stringhell = true;
} else
return;
input_files.push_back((boost::filesystem::path(Slic3r::resources_dir()) / "handy_models" / file_name));
plater()->load_files(input_files, LoadStrategy::LoadModel);
// Suggest to change settings for stringhell
// This serves as mini tutorial for new users
if (is_stringhell) {
wxGetApp().CallAfter([=] {
DynamicPrintConfig* m_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
bool is_only_one_wall_top = m_config->opt_bool("only_one_wall_top");
auto min_width_top_surface = m_config->option<ConfigOptionFloatOrPercent>("min_width_top_surface")->value;
if (is_only_one_wall_top && min_width_top_surface > 0) {
wxString msg_text = _L("This model features text embossment on the top surface. For optimal results, it is "
"advisable to set the 'One Wall Threshold(min_width_top_surface)' "
"to 0 for the 'Only One Wall on Top Surfaces' to work best.\n"
"Yes - Change these settings automatically\n"
"No - Do not change these settings for me");
MessageDialog dialog(wxGetApp().plater(), msg_text, "Suggestion", wxICON_WARNING | wxYES | wxNO);
if (dialog.ShowModal() == wxID_YES) {
m_config->set_key_value("min_width_top_surface", new ConfigOptionFloatOrPercent(0, false));
wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty();
wxGetApp().get_tab(Preset::TYPE_PRINT)->reload_config();
}
wxGetApp().plater()->update();
}
});
}
},
"", menu);
}