]> SALOME platform Git repositories - modules/shaper.git/blob - src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.cpp
Salome HOME
Fixed validators for Boolean and Intersection
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_BREPImport.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    GeomAlgoAPI_BREPImport.cpp
4 // Created: May 14, 2015
5 // Author:  Sergey POKHODENKO
6
7 #include <GeomAlgoAPI_BREPImport.h>
8
9 #include <TopoDS_Shape.hxx>
10
11 #include <BRepTools.hxx>
12 #include <BRep_Builder.hxx>
13
14 //=============================================================================
15 /*!
16  *
17  */
18 //=============================================================================
19 std::shared_ptr<GeomAPI_Shape> BREPImport(const std::string& theFileName,
20                                           const std::string&,
21                                           std::string& theError)
22 {
23   #ifdef _DEBUG
24   std::cout << "Import BREP from file " << theFileName << std::endl;
25   #endif
26   TopoDS_Shape aShape;
27   BRep_Builder aBuilder;
28   BRepTools::Read(aShape, theFileName.c_str(), aBuilder);
29   if (aShape.IsNull()) {
30     theError = "BREP Import failed";
31   }
32
33   std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape);
34   aGeomShape->setImpl(new TopoDS_Shape(aShape));
35   return aGeomShape;
36 }