use plate name in job name if set

This commit is contained in:
SoftFever 2023-03-31 18:01:05 +08:00
parent 8c06837e17
commit 32d952587d
2 changed files with 8 additions and 3 deletions

View file

@ -256,7 +256,7 @@ public:
// SoftFever
//get the plate's name
std::string get_plate_name() { return m_name; }
std::string get_plate_name() const { return m_name; }
void generate_plate_name_texture();
//set the plate's name
void set_plate_name(const std::string& name);
@ -640,6 +640,7 @@ public:
int get_curr_plate_index() const { return m_current_plate; }
PartPlate* get_curr_plate() { return m_plate_list[m_current_plate]; }
const PartPlate* get_curr_plate() const { return m_plate_list[m_current_plate]; }
std::vector<PartPlate*>& get_plate_list() { return m_plate_list; };

View file

@ -6568,8 +6568,12 @@ wxString Plater::priv::get_project_filename(const wxString& extension) const
wxString Plater::priv::get_export_gcode_filename(const wxString& extension, bool only_filename, bool export_all) const
{
std::string plate_index_str;
if (partplate_list.get_plate_count() > 1)
auto plate_name = partplate_list.get_curr_plate()->get_plate_name();
if (!plate_name.empty())
plate_index_str = (boost::format("_%1%") % plate_name).str();
else if (partplate_list.get_plate_count() > 1)
plate_index_str = (boost::format("_plate_%1%") % std::to_string(partplate_list.get_curr_plate_index() + 1)).str();
if (!m_project_folder.empty()) {
if (!only_filename) {
if (export_all) {
@ -6587,7 +6591,7 @@ wxString Plater::priv::get_export_gcode_filename(const wxString& extension, bool
}
} else {
if (only_filename) {
if(m_project_name == L"Untitled")
if(m_project_name == _L("Untitled"))
return fs::path(model.objects.front()->name).replace_extension().c_str() + wxString(plate_index_str) + extension;
if (export_all)