caizm 1 rok pred
rodič
commit
bdf33ccb3f

+ 39 - 12
CAE_Solution/src/acis/cmdmainprocess.cpp

@@ -12,6 +12,9 @@
 #include "at_str.hxx"
 #include "at_int.hxx"
 #include "../Rabbitmq/sendLogMsg/logmsg.h"
+#include "boost/uuid/uuid.hpp"
+#include "boost/uuid/uuid_io.hpp"
+#include "boost/uuid/uuid_generators.hpp"
 
 
 // Global variables to control the demonstration of advanced meshing functionalities
@@ -507,26 +510,24 @@ bool cmdMainProcess::CreateProcess_(string pathGeo, string pathParam)
     msg_str.clear();
     msg_str.append("6. Save the surface mesh to .mesh (optional)");
     emit LogMsg::getInstance()->send_to_sendClient(object->ToJson("log",msg_str));
-    QString appPath = dDir+"\\Data\\";//qy 2023-03-24修改路径
-    QDateTime data = QDateTime::currentDateTime();
-    QString strName;
-
+    string strName = get_uuid();
+    string appPath = get_file_path(object->da_struct->geoPath);
     if (ADIParam_.strResultFormat == ".ugrid")
     {
-        strName = data.toString("yyyy_MM_dd_HH_mm_ss") + "Result.ugrid";
-        crw->WirteUgridFoamFile(surfMesh_, QString(appPath + strName).toLatin1());
+        strName = strName+".ugrid";
+        crw->WirteUgridFoamFile(surfMesh_,(appPath+strName).c_str());
     }
     else if (ADIParam_.strResultFormat == ".vtk") {
-        strName = data.toString("yyyy_MM_dd_HH_mm_ss") + "Result.vtk";
-        crw->WirteVtkFoamFile(surfMesh_, QString(appPath + strName).toLatin1());
+        strName = strName+".vtk";
+        crw->WirteVtkFoamFile(surfMesh_,(appPath + strName).c_str());
     }
     else if (ADIParam_.strResultFormat == ".bdf") {
-        strName = data.toString("yyyy_MM_dd_HH_mm_ss") + "Result.bdf";
-        crw->WirteBDFFoamFile(surfMesh_, QString(appPath + strName).toLatin1());
+        strName = strName+".bdf";
+        crw->WirteBDFFoamFile(surfMesh_,(appPath + strName).c_str());
     }
     else if (ADIParam_.strResultFormat == ".neu") {
-        strName = data.toString("yyyy_MM_dd_HH_mm_ss") + "Result.neu";
-        crw->WriteNeuFoamFile(surfMesh_, QString(appPath + strName).toLatin1());
+        strName = strName+".neu";
+        crw->WriteNeuFoamFile(surfMesh_,(appPath + strName).c_str());
     }
 
 
@@ -605,6 +606,32 @@ void cmdMainProcess::exit_on_bad_outcome(const outcome &o)
         }
 }
 
+/*
+ * @brief: split complete file path
+ * @param: file path
+ * @ret: file path(just include dir)
+ * @birth: created by czm in 20230928
+ */
+string cmdMainProcess::get_file_path(string &path)
+{
+    int num = path.find_last_of('/');
+    path = path.substr(0,num+1);
+    return path;
+}
+
+/*
+ * @brief: get uuid
+ * @param: void
+ * @ret: uuid
+ * @birth:created by czm in 20230928
+ */
+string cmdMainProcess::get_uuid()
+{
+    boost::uuids::uuid rand = boost::uuids::random_generator()();
+    const string uuid_string  = boost::uuids::to_string(rand);
+    return uuid_string;
+}
+
 /**
 * @brief set ADIParam To Spa3dpm::Parameters
 *

+ 2 - 1
CAE_Solution/src/acis/cmdmainprocess.h

@@ -79,7 +79,8 @@ private:
 //    void closeACIS();
     //some
     //static meshgems_status_t size_iso_edge(meshgems_integer edge_id, meshgems_real t, meshgems_real *size, void *user_data);
-
+    string get_file_path(string&);
+    string get_uuid();
 };
 
 #endif // CMDMAINPROCESS_H