Salome HOME
[bos #33687] EDF 26791 - Points cloud on face
[modules/geom.git] / src / IGESPlugin / IGESPlugin_IOperations.cxx
index 1857d6a6b071dbb72ced3f4716e19ca018aaed90..ce270659aeebd6991d88b300a36a1d1df6b1fb44 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2022  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -25,6 +25,7 @@
 #include "IGESPlugin_IImport.hxx"
 
 // KERNEL includes
+#include <Basics_DirUtils.hxx>
 #include <utilities.h>
 
 // GEOM includes
@@ -100,15 +101,15 @@ void IGESPlugin_IOperations::ExportIGES( const Handle(GEOM_Object)      theOrigi
       return;
     }
   }
-  catch( Standard_Failure ) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode( aFail->GetMessageString() );
+  catch( Standard_Failure& aFail ) {
+    SetErrorCode( aFail.GetMessageString() );
     return;
   }
 
   //Make a Python command
+  std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString());
   GEOM::TPythonDump(aFunction) << "geompy.ExportIGES(" << theOriginal << ", \""
-    << theFileName.ToCString() << "\", \"" << theVersion.ToCString() << "\" )";
+    << convFileName.c_str() << "\", \"" << theVersion.ToCString() << "\" )";
 
   SetErrorCode(OK);
 }
@@ -155,21 +156,21 @@ IGESPlugin_IOperations::ImportIGES( const TCollection_AsciiString& theFileName,
     }
     aSeq->Append(anImported);
 
-    // Greate material groups.
+    // Create material groups.
     // MakeMaterialGroups( anImported, aSeq );
   }
-  catch( Standard_Failure ) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode( aFail->GetMessageString() );
+  catch( Standard_Failure& aFail ) {
+    SetErrorCode( aFail.GetMessageString() );
     return NULL;
   }
 
   //Make a Python command
   GEOM::TPythonDump pd (aFunction);
+  std::string convFileName = Kernel_Utils::BackSlashToSlash(theFileName.ToCString());
   if( theIsIgnoreUnits )
-    pd << aSeq << " = geompy.ImportIGES(\"" << theFileName.ToCString() << "\", True)";
+    pd << aSeq << " = geompy.ImportIGES(\"" << convFileName.c_str() << "\", True)";
   else
-    pd << aSeq << " = geompy.ImportIGES(\"" << theFileName.ToCString() << "\")";
+    pd << aSeq << " = geompy.ImportIGES(\"" << convFileName.c_str() << "\")";
   SetErrorCode(OK);
 
   return aSeq;