File->Open Project allows to load .amf files
This commit is contained in:
parent
68bffee102
commit
8ae1dfd4d0
4 changed files with 23 additions and 11 deletions
|
@ -65,6 +65,7 @@ wxString file_wildcards(FileType file_type, const std::string &custom_extension)
|
||||||
/* FT_PRUSA */ "Prusa Control files (*.prusa)|*.prusa;*.PRUSA",
|
/* 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_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_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_INI */ "INI files (*.ini)|*.ini;*.INI",
|
||||||
/* FT_SVG */ "SVG files (*.svg)|*.svg;*.SVG",
|
/* FT_SVG */ "SVG files (*.svg)|*.svg;*.SVG",
|
||||||
|
@ -501,9 +502,9 @@ void GUI_App::load_project(wxWindow *parent, wxString& input_file)
|
||||||
{
|
{
|
||||||
input_file.Clear();
|
input_file.Clear();
|
||||||
wxFileDialog dialog(parent ? parent : GetTopWindow(),
|
wxFileDialog dialog(parent ? parent : GetTopWindow(),
|
||||||
_(L("Choose one file (3MF):")),
|
_(L("Choose one file (3MF/AMF):")),
|
||||||
app_config->get_last_dir(), "",
|
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)
|
if (dialog.ShowModal() == wxID_OK)
|
||||||
input_file = dialog.GetPath();
|
input_file = dialog.GetPath();
|
||||||
|
|
|
@ -40,6 +40,7 @@ enum FileType
|
||||||
FT_PRUSA,
|
FT_PRUSA,
|
||||||
FT_GCODE,
|
FT_GCODE,
|
||||||
FT_MODEL,
|
FT_MODEL,
|
||||||
|
FT_PROJECT,
|
||||||
|
|
||||||
FT_INI,
|
FT_INI,
|
||||||
FT_SVG,
|
FT_SVG,
|
||||||
|
|
|
@ -145,7 +145,7 @@ void MainFrame::update_title()
|
||||||
wxString title = wxEmptyString;
|
wxString title = wxEmptyString;
|
||||||
if (m_plater != nullptr)
|
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())
|
if (!project.empty())
|
||||||
title += (project + " - ");
|
title += (project + " - ");
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
#include <boost/algorithm/string/trim.hpp>
|
#include <boost/algorithm/string/trim.hpp>
|
||||||
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
#include <boost/filesystem/path.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)
|
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();
|
wxGetApp().mainframe->update_title();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue