コード例 #1
0
ファイル: nglib.cpp プロジェクト: 11235813/netgen
   // Loads geometry from IGES File
   DLL_HEADER Ng_OCC_Geometry * Ng_OCC_Load_IGES (const char * filename)
   {
      // Call the IGES File Load function. Note.. the geometry class 
      // is created and instantiated within the load function
      OCCGeometry * occgeo = LoadOCC_IGES(filename);

      return ((Ng_OCC_Geometry *)occgeo);
   }
コード例 #2
0
  NetgenGeometry *  OCCGeometryRegister :: Load (string filename) const
  {
    const char * lgfilename = filename.c_str();


    /*
    if (strcmp (&cfilename[strlen(cfilename)-3], "geo") == 0)
      {
	PrintMessage (1, "Load OCCG geometry file ", cfilename);
	
	extern OCCGeometry * ParseOCCG (istream & istr);

	ifstream infile(cfilename);

	OCCGeometry * hgeom = ParseOCCG (infile);
	if (!hgeom)
	  throw NgException ("geo-file should start with 'algebraic3d'");

	hgeom -> FindIdenticSurfaces(1e-8 * hgeom->MaxSize()); 
	return hgeom;
      }
    */


    if ((strcmp (&lgfilename[strlen(lgfilename)-4], "iges") == 0) ||
	(strcmp (&lgfilename[strlen(lgfilename)-3], "igs") == 0) ||
	(strcmp (&lgfilename[strlen(lgfilename)-3], "IGS") == 0) ||
	(strcmp (&lgfilename[strlen(lgfilename)-4], "IGES") == 0))
      {
	PrintMessage (1, "Load IGES geometry file ", lgfilename);
	OCCGeometry * occgeometry = LoadOCC_IGES (lgfilename);
	return occgeometry;
      }

    else if ((strcmp (&lgfilename[strlen(lgfilename)-4], "step") == 0) ||
		     (strcmp (&lgfilename[strlen(lgfilename)-3], "stp") == 0) ||
		     (strcmp (&lgfilename[strlen(lgfilename)-3], "STP") == 0) ||
		     (strcmp (&lgfilename[strlen(lgfilename)-4], "STEP") == 0))
      {
	PrintMessage (1, "Load STEP geometry file ", lgfilename);
	OCCGeometry * occgeometry = LoadOCC_STEP (lgfilename);
	return occgeometry;    
      }
    else if ((strcmp (&lgfilename[strlen(lgfilename)-4], "brep") == 0) ||
	     (strcmp (&lgfilename[strlen(lgfilename)-4], "Brep") == 0) ||
	     (strcmp (&lgfilename[strlen(lgfilename)-4], "BREP") == 0))
      {
	PrintMessage (1, "Load BREP geometry file ", lgfilename);
	OCCGeometry * occgeometry = LoadOCC_BREP (lgfilename);
	return occgeometry;
      }
    
    return NULL;
  }
コード例 #3
0
   // Loads geometry from IGES File
   DLL_HEADER Ng_OCC_Geometry * Ng_OCC_Load_IGES (const char * filename)
   {
      Ng_OCC_Geometry * geo = Ng_OCC_NewGeometry();

      OCCGeometry * occgeo = LoadOCC_IGES(filename);

      // Create the initial triangulation for the OCC 
      BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(occgeo->shape,0.1);

      geo = (Ng_OCC_Geometry *)occgeo;

      return (geo);
   }