Salome HOME
Fix for bug IPAL19437.
[modules/smesh.git] / src / SMESH_I / SMESH_subMesh_i.cxx
index 4df569cb6ba46c1461f203ee2cdb73fe8365b7ce..f0fbc25b306185e5ac0be43e28f409038c31d389 100644 (file)
@@ -35,9 +35,8 @@
 #include "OpUtil.hxx"
 #include "Utils_ExceptHandlers.hxx"
 
-#include <BRepTools.hxx>
-#include <TopoDS.hxx>
 #include <TopoDS_Iterator.hxx>
+#include <TopExp_Explorer.hxx>
 
 using namespace std;
 
@@ -458,8 +457,14 @@ GEOM::GEOM_Object_ptr SMESH_subMesh_i::GetSubShape()
   try {
     if ( _mesh_i->_mapSubMesh.find( _localId ) != _mesh_i->_mapSubMesh.end()) {
       TopoDS_Shape S = _mesh_i->_mapSubMesh[ _localId ]->GetSubShape();
-      if ( !S.IsNull() )
+      if ( !S.IsNull() ) {
         aShapeObj = _gen_i->ShapeToGeomObject( S );
+       //mzn: N7PAL16232, N7PAL16233
+       //In some cases it's possible that GEOM_Client contains the shape same to S, but
+       //with another orientation.
+       if (aShapeObj->_is_nil())
+         aShapeObj = _gen_i->ShapeToGeomObject( S.Reversed() );
+      }
     }
   }
   catch(SALOME_Exception & S_ex) {