Salome HOME
463f31c966cc3b8f460dfd11576c90e86fd67b33
[modules/geom.git] / src / IGESExport / IGESExport.cxx
1 // File:        IGESExport.cxx
2 // Created:     Wed May 19 14:49:45 2004
3 // Author:      Pavel TELKOV
4 //              <ptv@mutex.nnov.opencascade.com>
5
6 #include "utilities.h"
7
8 #include <IGESControl_Controller.hxx>
9 #include <IGESControl_Writer.hxx>
10 #include <Interface_Static.hxx>
11
12 #include <TCollection_AsciiString.hxx>
13 #include <TopoDS_Shape.hxx>
14
15 #ifdef WNT
16 #include <SALOME_WNT.hxx>
17 #else
18 #define SALOME_WNT_EXPORT
19 #endif
20
21 //=============================================================================
22 /*!
23  *
24  */
25 //=============================================================================
26
27 extern "C"
28 {
29 SALOME_WNT_EXPORT
30   int Export(const TopoDS_Shape& theShape, const TCollection_AsciiString& theFileName)
31   {
32     MESSAGE("Export IGES into file " << theFileName.ToCString());
33     try 
34       {
35         //VRV: OCC 4.0 migration
36         IGESControl_Controller::Init();
37         IGESControl_Writer ICW (Interface_Static::CVal("XSTEP.iges.unit"),
38                                 Interface_Static::IVal("XSTEP.iges.writebrep.mode"));
39         //VRV: OCC 4.0 migration
40         
41         ICW.AddShape( theShape );
42         ICW.ComputeModel();
43         if ( ICW.Write( theFileName.ToCString() ) )
44           return 1;
45       }
46     catch(Standard_Failure) 
47       {
48         //THROW_SALOME_CORBA_EXCEPTION("Exception catched in IGESExport", SALOME::BAD_PARAM);
49       }
50     return 0;
51   }
52 }