1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 #include <GeomAlgoAPI_STEPExport.h>
5 #include "GeomAlgoAPI_Tools.h"
8 #include <IFSelect_ReturnStatus.hxx>
9 #include <STEPControl_Writer.hxx>
10 #include <Interface_Static.hxx>
12 namespace STEPExport {
14 bool Export(const TCollection_AsciiString& theFileName,
15 const TCollection_AsciiString& theFormatName,
16 const TopoDS_Shape& theShape,
17 TCollection_AsciiString& theError)
20 std::cout << "Export STEP into file " << theFileName.ToCString() << std::endl;
25 // Set "C" numeric locale to save numbers correctly
26 GeomAlgoAPI_Tools::Localizer loc;
28 IFSelect_ReturnStatus status ;
29 //VRV: OCC 4.0 migration
30 STEPControl_Writer aWriter;
31 Interface_Static::SetCVal("xstep.cascade.unit","M");
32 Interface_Static::SetCVal("write.step.unit", "M");
33 Interface_Static::SetIVal("write.step.nonmanifold", 1);
34 status = aWriter.Transfer( theShape, STEPControl_AsIs );
35 //VRV: OCC 4.0 migration
36 if( status == IFSelect_RetDone )
37 status = aWriter.Write( theFileName.ToCString() );
39 // Return previous locale
40 if( status == IFSelect_RetDone )
43 catch (Standard_Failure)
45 theError = "Exception catched in STEPExport";
50 } // namespace STEPExport