- QAD_WaitCursor wc;
-
- if (IObject->hasReference()) {
- try {
- SALOMEDS::Study_var aStudy = GetActiveStudyDocument();
- SMESH_Hypothesis_var anHyp = IObjectToInterface<SMESH_Hypothesis>(IObject);
- SALOMEDS::SObject_var aHypSObj = aStudy->FindObjectID(IObject->getReference());
- if (!aHypSObj->_is_nil()) {
- SALOMEDS::SObject_var MorSM = SMESH::GetMeshOrSubmesh(aHypSObj);
- if (!MorSM->_is_nil()) {
- GEOM::GEOM_Object_var aShape = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
- if (!aShape->_is_nil()){
- SMESH::SMESH_Mesh_var aMesh =
- SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
- SMESH::SMESH_subMesh_var aSubMesh =
- SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
-
- if (!aSubMesh->_is_nil())
- aMesh = aSubMesh->GetFather();
-
- if (!aMesh->_is_nil()) {
- res = aMesh->RemoveHypothesis(aShape, anHyp);
- if ( res < SMESH::HYP_UNKNOWN_FATAL )
- SMESH::ModifiedMesh(MorSM, false);
- if ( res > SMESH::HYP_OK ) {
- wc.stop();
- processHypothesisStatus( res, anHyp, false );
- wc.start();
- }
- }
- }
- }
-
- SALOMEDS::SObject_var aHypSObj = aStudy->FindObjectID(IObject->getReference());
- if (!aHypSObj->_is_nil()) {
- SALOMEDS::SObject_var MorSM = SMESH::GetMeshOrSubmesh(aHypSObj);
- if (!MorSM->_is_nil()) {
- GEOM::GEOM_Object_var aShapeObject =SMESH::GetShapeOnMeshOrSubMesh(MorSM);
- if (!aShapeObject->_is_nil()){
- SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
-
- if (!aSubMesh->_is_nil())
- aMesh = aSubMesh->GetFather();
-
- if (!aMesh->_is_nil()) {
- res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
- if ( res < SMESH::HYP_UNKNOWN_FATAL )
- SMESH::ModifiedMesh(MorSM, false);
- if ( res > SMESH::HYP_OK ) {
- wc.stop();
- processHypothesisStatus( res, anHyp, false );
- wc.start();
- }
- }
- }
- }
- }
- }
- }
- catch( const SALOME::SALOME_Exception& S_ex ) {
- wc.stop();
- QtCatchCorbaException( S_ex );
- res = SMESH::HYP_UNKNOWN_FATAL;
- }
- }
- else if (IObject->hasEntry()) {
- if(MYDEBUG) MESSAGE("IObject entry " << IObject->getEntry());
+ SUIT_OverrideCursor wc;
+
+ try {
+ _PTR(Study) aStudy = GetActiveStudyDocument();
+ _PTR(SObject) aHypObj = aStudy->FindObjectID( IObject->getEntry() );
+ if( aHypObj )
+ {
+ _PTR(SObject) MorSM = SMESH::GetMeshOrSubmesh( aHypObj );
+ _PTR(SObject) aRealHypo;
+ if( aHypObj->ReferencedObject( aRealHypo ) )
+ {
+ SMESH_Hypothesis_var hypo = SMESH_Hypothesis::_narrow( SObjectToObject( aRealHypo ) );
+ RemoveHypothesisOrAlgorithmOnMesh( MorSM, hypo );
+ }
+ else
+ {
+ SMESH_Hypothesis_var hypo = SMESH_Hypothesis::_narrow( SObjectToObject( aHypObj ) );
+ SObjectList meshList = GetMeshesUsingAlgoOrHypothesis( hypo );
+ for( int i = 0; i < meshList.size(); i++ )
+ RemoveHypothesisOrAlgorithmOnMesh( meshList[ i ], hypo );
+ }
+ }