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 bool STEPExport(const std::string& theFileName,
17 const std::string& theFormatName,
18 const TopoDS_Shape& theShape,
19 std::string& theError)
22 std::cout << "Export STEP into file " << theFileName << std::endl;
27 // Set "C" numeric locale to save numbers correctly
28 GeomAlgoAPI_Tools::Localizer loc;
30 IFSelect_ReturnStatus status ;
31 //VRV: OCC 4.0 migration
32 STEPControl_Writer aWriter;
33 Interface_Static::SetCVal("xstep.cascade.unit","M");
34 Interface_Static::SetCVal("write.step.unit", "M");
35 Interface_Static::SetIVal("write.step.nonmanifold", 1);
36 status = aWriter.Transfer( theShape, STEPControl_AsIs );
37 //VRV: OCC 4.0 migration
38 if( status == IFSelect_RetDone )
39 status = aWriter.Write( theFileName.c_str() );
41 // Return previous locale
42 if( status == IFSelect_RetDone )
45 catch (Standard_Failure)
47 theError = "Exception catched in STEPExport";