-// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Author : Yoann AUDOUIN, EDF
// Module : SMESH
//
-
#include <utilities.h>
+#include <Utils_SALOME_Exception.hxx>
#include "SMESH_DriverShape.hxx"
// step include
//Occ include
#include <TopoDS.hxx>
+#ifndef WIN32
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
namespace fs = boost::filesystem;
+#endif
/**
* @brief Import the content of a shape file (STEP) into a TopDS_Shape object
Interface_Static::SetIVal("read.step.nonmanifold", 1);
IFSelect_ReturnStatus aStat = reader.ReadFile(shape_file.c_str());
if(aStat != IFSelect_RetDone){
- std::cerr << "Reading error for " << shape_file << std::endl;
- return true;
+ throw SALOME_Exception("Reading error for " + shape_file);
}
int NbTrans = reader.TransferRoots();
IFSelect_ReturnStatus aStat = aWriter.Transfer(aShape,STEPControl_AsIs);
if(aStat != IFSelect_RetDone){
- std::cerr << "Transfer error for " << shape_file << std::endl;
- return true;
+ throw SALOME_Exception("Reading error for " + shape_file);
}
aStat = aWriter.Write(shape_file.c_str());
if(aStat != IFSelect_RetDone){
- std::cerr << "Writing error for " << shape_file << std::endl;
- return true;
+ throw SALOME_Exception("Writing error for " + shape_file);
}
return aStat;
}
*
* @return error code
*/
-int importShape(const std::string shape_file, TopoDS_Shape& aShape){
+int SMESH_DriverShape::importShape(const std::string shape_file, TopoDS_Shape& aShape){
+#ifndef WIN32
std::string type = fs::path(shape_file).extension().string();
boost::algorithm::to_lower(type);
if (type == ".brep"){
} else if (type == ".step"){
return importSTEPShape(shape_file, aShape);
} else {
- std::cerr << "Unknow format: " << type << std::endl;
- return true;
+ throw SALOME_Exception("Unknow format for importShape: " + type);
}
+#else
+ return 0;
+#endif
}
/**
*
* @return error code
*/
-int exportShape(const std::string shape_file, const TopoDS_Shape& aShape){
+int SMESH_DriverShape::exportShape(const std::string shape_file, const TopoDS_Shape& aShape){
+#ifndef WIN32
std::string type = fs::path(shape_file).extension().string();
boost::algorithm::to_lower(type);
if (type == ".brep"){
} else if (type == ".step"){
return exportSTEPShape(shape_file, aShape);
} else {
- std::cerr << "Unknow format: " << type << std::endl;
- return true;
+ throw SALOME_Exception("Unknow format for exportShape: " + type);
}
+#else
+ return 0;
+#endif
}