Salome HOME
47981c071beaf595cc8dfa5f046e82e51be19ead
[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                        const TCollection_AsciiString& /*theFormatName*/,
27                        TCollection_AsciiString&       theError)
28   {
29     MESSAGE("Import BREP from file " << theFileName);
30     TopoDS_Shape aShape;
31     BRep_Builder B;
32     BRepTools::Read(aShape, theFileName.ToCString(), B);
33     if (aShape.IsNull()) {
34       theError = "BREP Import failed";
35     }
36     return aShape;
37   }
38 }