From 5eee758c9e449e92eeb804de5d51efa234cc97a0 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Thu, 29 Dec 2022 23:12:48 +0800 Subject: [PATCH] QOL change: Don't add "_plate_0" in file name if there is only one plate in the current project --- src/slic3r/GUI/PartPlate.cpp | 2 +- src/slic3r/GUI/PartPlate.hpp | 2 +- src/slic3r/GUI/Plater.cpp | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 062a1b0965..922d2c8743 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -3034,7 +3034,7 @@ double PartPlateList::plate_stride_y() } //get the plate counts, not including the invalid plate -int PartPlateList::get_plate_count() +int PartPlateList::get_plate_count() const { int ret = 0; diff --git a/src/slic3r/GUI/PartPlate.hpp b/src/slic3r/GUI/PartPlate.hpp index adafd842e1..3544ad69d0 100644 --- a/src/slic3r/GUI/PartPlate.hpp +++ b/src/slic3r/GUI/PartPlate.hpp @@ -614,7 +614,7 @@ public: int select_plate(int index); //get the plate counts, not including the invalid plate - int get_plate_count(); + int get_plate_count() const; //update the plate cols due to plate count change void update_plate_cols(); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 9738eb440e..3aa57f012b 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -6438,7 +6438,9 @@ 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 = (boost::format("_plate_%1%") % std::to_string(partplate_list.get_curr_plate_index() + 1)).str(); + std::string plate_index_str; + 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) {