]> SALOME platform Git repositories - modules/smesh.git/blobdiff - src/SMESH_I/SMESH_Gen_i_1.cxx
Salome HOME
PAL17694 (New Tool About Hexahedral Meshing)
[modules/smesh.git] / src / SMESH_I / SMESH_Gen_i_1.cxx
index e76000901dd85103799c487127ab54c4c30fcf99..2460bcc1cb82e1ca9891ffd18d3cad1e6eda8a5f 100644 (file)
@@ -32,6 +32,7 @@
 #include "SMESH_Hypothesis_i.hxx"
 #include "SMESH_Algo_i.hxx"
 #include "SMESH_Group_i.hxx"
+#include "SMESH_subMesh_i.hxx"
 
 #include "SMESH.hxx"
 
@@ -739,10 +740,15 @@ SALOMEDS::SObject_ptr
 {
   if(MYDEBUG) MESSAGE("GetMeshOrSubmeshByShape")
   SALOMEDS::SObject_var aMeshOrSubMesh;
-  if ( theShape->_is_nil() || theMesh->_is_nil() )
+  if (theMesh->_is_nil() || ( theShape->_is_nil() && theMesh->HasShapeToMesh()))
     return aMeshOrSubMesh._retn();
+  
+  TopoDS_Shape aShape;
+  if(theMesh->HasShapeToMesh())
+    aShape = GeomObjectToShape( theShape );
+  else
+    aShape = SMESH_Mesh::PseudoShape();
 
-  TopoDS_Shape aShape = GeomObjectToShape( theShape );
   SMESH_Mesh_i* mesh_i = objectToServant<SMESH_Mesh_i>( theMesh );
 
   if ( !aShape.IsNull() && mesh_i && mesh_i->GetImpl().GetMeshDS() ) {
@@ -772,7 +778,8 @@ bool SMESH_Gen_i::AddHypothesisToShape(SALOMEDS::Study_ptr         theStudy,
 {
   if(MYDEBUG) MESSAGE("AddHypothesisToShape")
   if (theStudy->_is_nil() || theMesh->_is_nil() ||
-      theHyp->_is_nil() || theShape->_is_nil() )
+      theHyp->_is_nil() || (theShape->_is_nil()
+                            && theMesh->HasShapeToMesh()) )
     return false;
 
   SALOMEDS::SObject_var aMeshSO = ObjectToSObject( theStudy, theMesh );
@@ -826,7 +833,8 @@ bool SMESH_Gen_i::RemoveHypothesisFromShape(SALOMEDS::Study_ptr         theStudy
                                             SMESH::SMESH_Hypothesis_ptr theHyp)
 {
   if (theStudy->_is_nil() || theMesh->_is_nil() ||
-      theHyp->_is_nil() || theShape->_is_nil() )
+      theHyp->_is_nil() || (theShape->_is_nil()
+                            && theMesh->HasShapeToMesh()))
     return false;
 
   SALOMEDS::SObject_var aHypSO = ObjectToSObject( theStudy, theHyp );