Write STEP files in meters

This commit is contained in:
jfa 2012-11-01 09:04:40 +00:00
parent 368a824418
commit 6bc3fcbb2a

View File

@ -18,13 +18,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: STEPExport.cxx // File: STEPExport.cxx
// Created: Wed May 19 14:53:52 2004 // Created: Wed May 19 14:53:52 2004
// Author: Pavel TELKOV // Author: Pavel TELKOV
// <ptv@mutex.nnov.opencascade.com>
//
#include "utilities.h" #include "utilities.h"
#include <Basics_Utils.hxx> #include <Basics_Utils.hxx>
@ -63,36 +61,37 @@
extern "C" extern "C"
{ {
STEPEXPORT_EXPORT STEPEXPORT_EXPORT
int Export(const TopoDS_Shape& theShape, const TCollection_AsciiString& theFileName) int Export(const TopoDS_Shape& theShape, const TCollection_AsciiString& theFileName)
{ {
MESSAGE("Export STEP into file " << theFileName.ToCString()); MESSAGE("Export STEP into file " << theFileName.ToCString());
try try
{ {
// Set "C" numeric locale to save numbers correctly // Set "C" numeric locale to save numbers correctly
Kernel_Utils::Localizer loc; Kernel_Utils::Localizer loc;
IFSelect_ReturnStatus status ; IFSelect_ReturnStatus status ;
//VRV: OCC 4.0 migration //VRV: OCC 4.0 migration
STEPControl_Writer aWriter; STEPControl_Writer aWriter;
//VSR: 16/09/09: Convert to METERS //VSR: 16/09/09: Convert to METERS
Interface_Static::SetCVal("xstep.cascade.unit","M"); Interface_Static::SetCVal("xstep.cascade.unit","M");
Interface_Static::SetIVal("write.step.nonmanifold", 1); Interface_Static::SetCVal("write.step.unit", "M");
//JFA: PAL6162 status = aWriter.Transfer( theShape, STEPControl_ManifoldSolidBrep ); Interface_Static::SetIVal("write.step.nonmanifold", 1);
status = aWriter.Transfer( theShape, STEPControl_AsIs ); //JFA: PAL6162 status = aWriter.Transfer( theShape, STEPControl_ManifoldSolidBrep );
//VRV: OCC 4.0 migration status = aWriter.Transfer( theShape, STEPControl_AsIs );
if ( status == IFSelect_RetDone ) //VRV: OCC 4.0 migration
if ( status == IFSelect_RetDone )
status = aWriter.Write( theFileName.ToCString() ); status = aWriter.Write( theFileName.ToCString() );
// Return previous locale // Return previous locale
if ( status == IFSelect_RetDone ) if ( status == IFSelect_RetDone )
return 1; return 1;
} }
catch(Standard_Failure) catch (Standard_Failure)
{ {
//THROW_SALOME_CORBA_EXCEPTION("Exception catched in STEPExport", SALOME::BAD_PARAM); //THROW_SALOME_CORBA_EXCEPTION("Exception catched in STEPExport", SALOME::BAD_PARAM);
} }
return 0; return 0;
} }
} }