[cgma-dev] r2212 - cgm/trunk/itaps

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Wed Nov 5 12:24:06 CST 2008


Author: kraftche
Date: 2008-11-05 12:24:06 -0600 (Wed, 05 Nov 2008)
New Revision: 2212

Modified:
   cgm/trunk/itaps/iGeom_CGMA.cc
Log:
Allow 'engine=ACIS' or 'engine=OCC' in iGeom_newGeom options

Modified: cgm/trunk/itaps/iGeom_CGMA.cc
===================================================================
--- cgm/trunk/itaps/iGeom_CGMA.cc	2008-11-05 18:19:29 UTC (rev 2211)
+++ cgm/trunk/itaps/iGeom_CGMA.cc	2008-11-05 18:24:06 UTC (rev 2212)
@@ -228,7 +228,7 @@
   iGeom_getLastError( *err, descr, descr_len );
 }
 
-void iGeom_newGeom( const char* ,
+void iGeom_newGeom( const char* options,
                     iGeom_Instance* instance_out,
                     int* err,
                     const int options_size) 
@@ -239,16 +239,29 @@
   
   CubitStatus status = InitCGMA::initialize_cgma();
   if (CUBIT_SUCCESS != status) RETURN(iBase_FAILURE);
+  
+    // scan options for engine to use
+  std::string engine;
+  if (options && options_size) {
+    char* opt = (char*)malloc( options_size + 1 );
+    memcpy(opt, options, options_size);
+    opt[options_size] = '\0';
+    const char delim[] = { opt[0], '\0' };
+    for (char* s = strtok(opt+1, delim); s; s = strtok(0,delim)) {
+      char* v = strchr( s, '=' );
+      if (v) {
+        *v = '\0';
+        ++v;
+      }
+      if (!strcmp(s,"engine")) {
+        engine = std::string(v);
+        break;
+      }
+    }
+    free(opt);
+  }
+  InitCGMA::initialize_engine(engine.empty() ? 0 : engine.c_str());
 
-#ifdef HAVE_ACIS  
-  status = InitCGMA::initialize_engine("ACIS");
-  if (CUBIT_SUCCESS != status) RETURN(iBase_FAILURE);
-#endif
-
-#ifdef HAVE_OCC
-  InitCGMA::initialize_engine("OCC");
-#endif
-
 // sometimes can't have following, depending on CGM version
   // CGMApp::instance()->attrib_manager()->silent_flag(true);
 




More information about the cgma-dev mailing list