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