1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GEOMALGOAPI_STEPExport.cpp
4 // Created: May 14, 2015
5 // Author: Sergey POKHODENKO
7 #include <GeomAlgoAPI_STEPExport.h>
9 #include "GeomAlgoAPI_Tools.h"
12 #include <IFSelect_ReturnStatus.hxx>
13 #include <STEPControl_Writer.hxx>
14 #include <Interface_Static.hxx>
16 namespace STEPExport {
18 bool Export(const std::string& theFileName,
19 const std::string& theFormatName,
20 const TopoDS_Shape& theShape,
21 std::string& theError)
24 std::cout << "Export STEP into file " << theFileName << std::endl;
29 // Set "C" numeric locale to save numbers correctly
30 GeomAlgoAPI_Tools::Localizer loc;
32 IFSelect_ReturnStatus status ;
33 //VRV: OCC 4.0 migration
34 STEPControl_Writer aWriter;
35 Interface_Static::SetCVal("xstep.cascade.unit","M");
36 Interface_Static::SetCVal("write.step.unit", "M");
37 Interface_Static::SetIVal("write.step.nonmanifold", 1);
38 status = aWriter.Transfer( theShape, STEPControl_AsIs );
39 //VRV: OCC 4.0 migration
40 if( status == IFSelect_RetDone )
41 status = aWriter.Write( theFileName.c_str() );
43 // Return previous locale
44 if( status == IFSelect_RetDone )
47 catch (Standard_Failure)
49 theError = "Exception catched in STEPExport";
54 } // namespace STEPExport