Salome HOME
Copyright update 2020
[modules/geom.git] / src / VTKPlugin / VTKPlugin_IOperations.cxx
index a9f31f6247b9e1a90df11e995289b93745a30f9d..6e8ea8dc090c66ccaae7b8fa98c619cee8b65de1 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2020  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
@@ -23,6 +23,7 @@
 #include "VTKPlugin_IExport.hxx"
 
 // KERNEL includes
+#include <Basics_DirUtils.hxx>
 #include <utilities.h>
 
 // GEOM includes
@@ -36,8 +37,8 @@
  *  Constructor
  */
 //=============================================================================
-VTKPlugin_IOperations::VTKPlugin_IOperations( GEOM_Engine* theEngine, int theDocID )
-: GEOMImpl_IBaseIEOperations( theEngine, theDocID )
+VTKPlugin_IOperations::VTKPlugin_IOperations( GEOM_Engine* theEngine )
+: GEOMImpl_IBaseIEOperations( theEngine )
 {
   MESSAGE( "VTKPlugin_IOperations::VTKPlugin_IOperations" );
 }
@@ -72,7 +73,7 @@ void VTKPlugin_IOperations::ExportVTK( const Handle(GEOM_Object)      theOrigina
   if( aRefFunction.IsNull() ) return;  //There is no function which creates an object to be exported
 
   //Add a new result object
-  Handle(GEOM_Object) result = GetEngine()->AddObject( GetDocID(), GEOM_IMPORT);
+  Handle(GEOM_Object) result = GetEngine()->AddObject( GEOM_IMPORT);
 
   //Add an Export function
   Handle(GEOM_Function) aFunction = result->AddFunction( VTKPlugin_ExportDriver::GetID(), EXPORT_SHAPE );
@@ -95,15 +96,15 @@ void VTKPlugin_IOperations::ExportVTK( const Handle(GEOM_Object)      theOrigina
       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.ExportVTK(" << theOriginal << ", \""
-    << theFileName.ToCString() << "\", " << theDeflection << ")";
+    << convFileName.c_str() << "\", " << theDeflection << ")";
 
   SetErrorCode(OK);
 }