Salome HOME
Merge with version on tag OCC-V2_1_0d
[modules/geom.git] / src / BREPImport / BREPImport.cxx
1 // File:        BREPImport.cxx
2 // Created:     Wed May 19 14:29:52 2004
3 // Author:      Pavel TELKOV
4 //              <ptv@mutex.nnov.opencascade.com>
5
6 #include "utilities.h"
7
8 #include <BRepTools.hxx>
9 #include <BRep_Builder.hxx>
10
11 #include <TCollection_AsciiString.hxx>
12 #include <TopoDS_Shape.hxx>
13
14 //=============================================================================
15 /*!
16  *
17  */
18 //=============================================================================
19
20 extern "C"
21 {
22 #ifdef WNT
23   __declspec(__dllexport)
24 #endif
25   TopoDS_Shape Import (const TCollection_AsciiString& theFileName,
26                        TCollection_AsciiString&       theError)
27   {
28     MESSAGE("Import BREP from file " << theFileName);
29     TopoDS_Shape aShape;
30     BRep_Builder B;
31     BRepTools::Read(aShape, theFileName.ToCString(), B);
32     if (aShape.IsNull()) {
33       theError = "BREP Import failed";
34     }
35     return aShape;
36   }
37 }