Salome HOME
task "Dump Python". Puslish submesh when assigning a local hypothesis
authoreap <eap@opencascade.com>
Fri, 25 Mar 2005 13:05:29 +0000 (13:05 +0000)
committereap <eap@opencascade.com>
Fri, 25 Mar 2005 13:05:29 +0000 (13:05 +0000)
src/SMESH_I/SMESH_Gen_i_1.cxx

index 4e50171a648b0b8e3008c47a33cff4e9d063c95e..2b5593e58e60eefa5d0d1c2004d4a79e7356b057 100644 (file)
@@ -773,7 +773,19 @@ bool SMESH_Gen_i::AddHypothesisToShape(SALOMEDS::Study_ptr         theStudy,
   SALOMEDS::SObject_var aMeshOrSubMesh =
     GetMeshOrSubmeshByShape( theStudy, theMesh, theShape );
   if ( aMeshOrSubMesh->_is_nil() )
-    return false;
+  {
+    // publish submesh
+    TopoDS_Shape aShape = GeomObjectToShape( theShape );
+    SMESH_Mesh_i* mesh_i = objectToServant<SMESH_Mesh_i>( theMesh );
+    if ( !aShape.IsNull() && mesh_i && mesh_i->GetImpl().GetMeshDS() ) {
+      SMESHDS_Mesh* meshDS = mesh_i->GetImpl().GetMeshDS();
+      int shapeID = meshDS->ShapeToIndex( aShape );
+      SMESH::SMESH_subMesh_var aSubMesh = mesh_i->getSubMesh(shapeID);
+      aMeshOrSubMesh = PublishSubMesh( theStudy, theMesh, aSubMesh, theShape );
+    }
+    if ( aMeshOrSubMesh->_is_nil() )
+      return false;
+  }
 
   //Find or Create Applied Hypothesis root
   bool aIsAlgo = !SMESH::SMESH_Algo::_narrow( theHyp )->_is_nil();