Browse Source

0922 修改iop初始化

caizm 2 years ago
parent
commit
4132bf43ac
2 changed files with 39 additions and 0 deletions
  1. 1 0
      CAE_Solution/src/main.cpp
  2. 38 0
      CAE_Solution/src/manager_acis_modeller.h

+ 1 - 0
CAE_Solution/src/main.cpp

@@ -37,6 +37,7 @@ int main(int argc, char *argv[])
     qRegisterMetaType<std::string>("std::string");
 
     iniACIS();
+    initIop();
 
     QApplication a(argc, argv);
     Widget w;

+ 38 - 0
CAE_Solution/src/manager_acis_modeller.h

@@ -1,6 +1,8 @@
 #ifndef MANAGER_ACIS_MODELLER_H
 #define MANAGER_ACIS_MODELLER_H
 #include "acis/cmdmainprocess.h"
+#include "SPAIopAcisSystem.h"
+#include "spatial_license.h"
 
 extern void unlock_license();
 
@@ -17,6 +19,42 @@ void iniACIS(){
     printf("Successful initialization\n");
 }
 
+/*
+ * @brief: init iop
+ * @param: void
+ * @ret: void
+ * @birth: created by czm in 20230922
+ */
+bool initIop(){
+    // IOP is called in its own scope.
+    // This sample uses a guard class that initializes InterOp upon
+    // construction and terminates InterOp upon destruction.  All
+    // translations are done within the boundaries of a single
+    // initialization and shutdown.  InterOp may only be initialized
+    // and shutdown once per process.  Please do not use the guard
+    // classes multiple times per process.
+    SPAIopAcisSystemInitGuard initGuard(SPATIAL_LICENSE);
+    int result = initGuard.GetInitStatus();
+
+    if (SPA_UNLOCK_NO_MSG == result)
+    {
+        // Spatial products have been unlocked
+        printf("SUCCESS: SPAIopAcisSystem::Initialize. \n");
+    }
+    else if (SPA_UNLOCK_KEY_WARN_EXPIRE == result)
+        printf("SPAIopAcisSystem::Initialize returned SPA_UNLOCK_KEY_WARN_EXPIRE; your license key will expire soon!\n");
+    else if (SPA_UNLOCK_REGISTRATION_WARN_EXPIRE == result)
+        printf("SPAIopAcisSystem::Initialize returned SPA_UNLOCK_REGISTRATION_WARN_EXPIRE; your registration will expire soon.\n");
+    else
+    {
+        printf("SPAIopAcisSystem::Initialize returned an unexpected value; Contact Spatial Customer Support or your Account Manager.\n");
+        return false;
+    }
+    result = 1;
+    return true;
+}
+
+
 /*
  * @brief: close acis
  * @param: void