From 5ddb47a8cdc80f0f308dc5254a534998749c8605 Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Sat, 10 Jun 2023 15:46:29 +0800 Subject: [PATCH] ENH: CLI: output stl files into a subdirectory Change-Id: I3d1a3685713a498d7d66e9d5cbabf90aaa3ffe43 (cherry picked from commit bcb352f48995f7c3488bdf8d5636499fcd2b714c) --- src/BambuStudio.cpp | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/BambuStudio.cpp b/src/BambuStudio.cpp index 2dcca6092..2efc93b8f 100644 --- a/src/BambuStudio.cpp +++ b/src/BambuStudio.cpp @@ -2980,12 +2980,24 @@ std::string CLI::output_filepath(const Model &model, IO::ExportFormat format) co std::string CLI::output_filepath(const ModelObject &object, unsigned int index, IO::ExportFormat format) const { - std::string ext, file_name, output_path; + std::string ext, subdir, file_name, output_path; switch (format) { - case IO::AMF: ext = ".zip.amf"; break; - case IO::OBJ: ext = ".obj"; break; - case IO::STL: ext = ".stl"; break; - case IO::TMF: ext = ".3mf"; break; + case IO::AMF: + ext = ".zip.amf"; + subdir = "amf"; + break; + case IO::OBJ: + ext = ".obj"; + subdir = "obj"; + break; + case IO::STL: + ext = ".stl"; + subdir = "stl"; + break; + case IO::TMF: + ext = ".3mf"; + subdir = "3mf"; + break; default: assert(false); break; }; // use --outputdir when available @@ -2998,11 +3010,14 @@ std::string CLI::output_filepath(const ModelObject &object, unsigned int index, BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": file_name="<