[cgma-dev] r2483 - cgm/trunk/geom/OCC

janehu at mcs.anl.gov janehu at mcs.anl.gov
Mon Dec 15 13:30:48 CST 2008


Author: janehu
Date: 2008-12-15 13:30:48 -0600 (Mon, 15 Dec 2008)
New Revision: 2483

Modified:
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
Log:
Added reader for iges or step files, not testing yet.

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-12-12 20:02:20 UTC (rev 2482)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-12-15 19:30:48 UTC (rev 2483)
@@ -35,6 +35,9 @@
 #include "Handle_Poly_Triangulation.hxx"
 #include "GCPnts_TangentialDeflection.hxx"
 #include "BRepAdaptor_Curve.hxx"
+#include "STEPControl_Reader.hxx"
+#include "IGESControl_Reader.hxx"
+#include "IFSelect_ReturnStatus.hxx"
 #include "BndLib_Add3dCurve.hxx"
 #include "Poly_Polygon3D.hxx"
 #include "Handle_Poly_Polygon3D.hxx"
@@ -1122,7 +1125,8 @@
                                       DLIList<TopologyBridge*> &bridge_list )
 {
   //make sure that file_type == "OCC"
-  if( !strcmp( file_type,"OCC") )
+  if( !strcmp( file_type,"OCC") || !strcmp( file_type,"IGES") ||
+      !strcmp( file_type,"STEP") )
     return import_solid_model( file_name, file_type, bridge_list );
   else
     return CUBIT_FAILURE;
@@ -1150,10 +1154,38 @@
 					       CubitBoolean free_surfaces)
 {
   TopoDS_Shape *aShape = new TopoDS_Shape;
-  BRep_Builder aBuilder;
-  Standard_Boolean result = Read(*aShape, (char*) file_name, mainLabel, print_results);
-  if (result==0) return CUBIT_FAILURE;
-  
+  //BRep_Builder aBuilder;
+  if(strcmp(file_type ,"OCC") == 0)
+  {
+    Standard_Boolean result = Read(*aShape, (char*) file_name, mainLabel, print_results);
+    if (result==0) return CUBIT_FAILURE;
+  }
+ 
+  else if (strcmp(file_type, "STEP") == 0)
+  {
+    STEPControl_Reader reader;
+    IFSelect_ReturnStatus stat = reader.ReadFile( (char*) file_name);
+    if (stat  != IFSelect_RetDone)
+    {
+       PRINT_INFO("%s: Cannot open file", file_name );
+       return CUBIT_FAILURE;
+    } 
+    reader.TransferRoots();
+    *aShape = reader.OneShape(); 
+  }
+
+  else if(strcmp(file_type, "IGES") == 0)
+  {
+    IGESControl_Reader reader;
+    IFSelect_ReturnStatus stat = reader.ReadFile( (char*) file_name);
+    if (stat  != IFSelect_RetDone)
+    {
+       PRINT_INFO("%s: Cannot open file", file_name );
+       return CUBIT_FAILURE;
+    } 
+    reader.TransferRoots(); 
+    *aShape = reader.OneShape();
+  } 
   imported_entities = populate_topology_bridge(*aShape);
   return CUBIT_SUCCESS;
 }




More information about the cgma-dev mailing list