File->Open Project allows to load .amf files
This commit is contained in:
parent
68bffee102
commit
8ae1dfd4d0
@ -58,13 +58,14 @@ namespace GUI {
|
||||
wxString file_wildcards(FileType file_type, const std::string &custom_extension)
|
||||
{
|
||||
static const std::string defaults[FT_SIZE] = {
|
||||
/* FT_STL */ "STL files (*.stl)|*.stl;*.STL",
|
||||
/* FT_OBJ */ "OBJ files (*.obj)|*.obj;*.OBJ",
|
||||
/* FT_AMF */ "AMF files (*.amf)|*.zip.amf;*.amf;*.AMF;*.xml;*.XML",
|
||||
/* FT_3MF */ "3MF files (*.3mf)|*.3mf;*.3MF;",
|
||||
/* FT_PRUSA */ "Prusa Control files (*.prusa)|*.prusa;*.PRUSA",
|
||||
/* FT_GCODE */ "G-code files (*.gcode, *.gco, *.g, *.ngc)|*.gcode;*.GCODE;*.gco;*.GCO;*.g;*.G;*.ngc;*.NGC",
|
||||
/* FT_MODEL */ "Known files (*.stl, *.obj, *.amf, *.xml, *.3mf, *.prusa)|*.stl;*.STL;*.obj;*.OBJ;*.amf;*.AMF;*.xml;*.XML;*.3mf;*.3MF;*.prusa;*.PRUSA",
|
||||
/* FT_STL */ "STL files (*.stl)|*.stl;*.STL",
|
||||
/* FT_OBJ */ "OBJ files (*.obj)|*.obj;*.OBJ",
|
||||
/* FT_AMF */ "AMF files (*.amf)|*.zip.amf;*.amf;*.AMF;*.xml;*.XML",
|
||||
/* FT_3MF */ "3MF files (*.3mf)|*.3mf;*.3MF;",
|
||||
/* FT_PRUSA */ "Prusa Control files (*.prusa)|*.prusa;*.PRUSA",
|
||||
/* FT_GCODE */ "G-code files (*.gcode, *.gco, *.g, *.ngc)|*.gcode;*.GCODE;*.gco;*.GCO;*.g;*.G;*.ngc;*.NGC",
|
||||
/* FT_MODEL */ "Known files (*.stl, *.obj, *.amf, *.xml, *.3mf, *.prusa)|*.stl;*.STL;*.obj;*.OBJ;*.amf;*.AMF;*.xml;*.XML;*.3mf;*.3MF;*.prusa;*.PRUSA",
|
||||
/* FT_PROJECT */ "Project files (*.3mf, *.amf)|*.3mf;*.3MF;*.amf;*.AMF",
|
||||
|
||||
/* FT_INI */ "INI files (*.ini)|*.ini;*.INI",
|
||||
/* FT_SVG */ "SVG files (*.svg)|*.svg;*.SVG",
|
||||
@ -501,9 +502,9 @@ void GUI_App::load_project(wxWindow *parent, wxString& input_file)
|
||||
{
|
||||
input_file.Clear();
|
||||
wxFileDialog dialog(parent ? parent : GetTopWindow(),
|
||||
_(L("Choose one file (3MF):")),
|
||||
_(L("Choose one file (3MF/AMF):")),
|
||||
app_config->get_last_dir(), "",
|
||||
file_wildcards(FT_3MF), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
file_wildcards(FT_PROJECT), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
|
||||
if (dialog.ShowModal() == wxID_OK)
|
||||
input_file = dialog.GetPath();
|
||||
|
@ -40,6 +40,7 @@ enum FileType
|
||||
FT_PRUSA,
|
||||
FT_GCODE,
|
||||
FT_MODEL,
|
||||
FT_PROJECT,
|
||||
|
||||
FT_INI,
|
||||
FT_SVG,
|
||||
|
@ -145,7 +145,7 @@ void MainFrame::update_title()
|
||||
wxString title = wxEmptyString;
|
||||
if (m_plater != nullptr)
|
||||
{
|
||||
wxString project = from_path(into_path(m_plater->get_project_filename()).filename());
|
||||
wxString project = from_path(into_path(m_plater->get_project_filename()).stem());
|
||||
if (!project.empty())
|
||||
title += (project + " - ");
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <regex>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/algorithm/string/trim.hpp>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
@ -2947,7 +2948,16 @@ const wxString& Plater::priv::get_project_filename() const
|
||||
|
||||
void Plater::priv::set_project_filename(const wxString& filename)
|
||||
{
|
||||
m_project_filename = filename;
|
||||
wxString copy = filename;
|
||||
if (boost::algorithm::iends_with(copy, ".zip.amf"))
|
||||
// we remove the .zip part of the extension
|
||||
copy = boost::ireplace_last_copy(copy, ".zip.", ".");
|
||||
|
||||
// we force 3mf extension
|
||||
boost::filesystem::path full_path = into_path(copy);
|
||||
full_path.replace_extension("3mf");
|
||||
|
||||
m_project_filename = from_path(full_path);
|
||||
wxGetApp().mainframe->update_title();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user