Salome HOME
Issue #1112 tab key doesn't work on the last field of left panels
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_STEPExport.cpp
index fbf7f718b07c97704454c54c6998fd57674f5893..c9e9830c1829b293d7b67beac4db593e9b902fa8 100644 (file)
@@ -8,6 +8,8 @@
 
 #include "GeomAlgoAPI_Tools.h"
 
+#include <TopoDS_Shape.hxx>
+
 // OOCT includes
 #include <IFSelect_ReturnStatus.hxx>
 #include <STEPControl_Writer.hxx>
 
 bool STEPExport(const std::string& theFileName,
                 const std::string& theFormatName,
-                const TopoDS_Shape& theShape,
+                const std::shared_ptr<GeomAPI_Shape>& theShape,
                 std::string& theError)
 {
   #ifdef _DEBUG
   std::cout << "Export STEP into file " << theFileName << std::endl;
   #endif
 
+  if (!theShape.get()) {
+    theError = "STEP Export failed: An invalid argument";
+    return false;
+  }
+
   try
   {
     // Set "C" numeric locale to save numbers correctly
@@ -33,10 +40,10 @@ bool STEPExport(const std::string& theFileName,
     Interface_Static::SetCVal("xstep.cascade.unit","M");
     Interface_Static::SetCVal("write.step.unit", "M");
     Interface_Static::SetIVal("write.step.nonmanifold", 1);
-    status = aWriter.Transfer( theShape, STEPControl_AsIs );
+    status = aWriter.Transfer(theShape->impl<TopoDS_Shape>(), STEPControl_AsIs);
     //VRV: OCC 4.0 migration
     if( status == IFSelect_RetDone )
-      status = aWriter.Write( theFileName.c_str() );
+      status = aWriter.Write(theFileName.c_str());
 
     // Return previous locale
     if( status == IFSelect_RetDone )