From d547f440f838090c4aca61aa64b5f7d5b9e0aff4 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 14 Apr 2015 17:18:18 +0300 Subject: [PATCH] IMP 22635: EDF 8345 - Creation of group based on groups Bug: MAJORITY mode works wrong with triangles IMP 22877: EDF 10054 SMESH: Add a new filter "BelongToSmeshGroup" for Create Groupe Bug: Invalid Python dump --- src/SMESHGUI/SMESHGUI_FilterDlg.cxx | 11 +++-------- src/SMESH_I/SMESH_2smeshpy.cxx | 3 +++ src/SMESH_I/SMESH_Filter_i.cxx | 2 +- src/SMESH_I/SMESH_Mesh_i.cxx | 2 +- src/SMESH_SWIG/smeshBuilder.py | 7 +++++++ 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx index c1b80e0d0..c2f4bd6e2 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx @@ -3718,7 +3718,7 @@ void SMESHGUI_FilterDlg::onSelectionDone() } break; } - case SMESH::FT_BelongToMeshGroup: // get a group name and IOR + case SMESH::FT_BelongToMeshGroup: // get a group Name and Entry { SMESH::SMESH_GroupBase_var grp = SMESH::IObjectToInterface(anIO); if ( !grp->_is_nil() ) @@ -3732,13 +3732,8 @@ void SMESHGUI_FilterDlg::onSelectionDone() if ( !myGroup->_is_nil() && myGroup->IsInDependency( grp )) return; // avoid cyclic dependencies between Groups on Filter - SalomeApp_Application* app = dynamic_cast - ( SUIT_Session::session()->activeApplication() ); - if( !app ) return; - CORBA::String_var IOR = app->orb()->object_to_string( grp ); - myTable->SetThreshold(aRow, SMESH::toQStr( grp->GetName() )); - myTable->SetID (aRow, IOR.in() ); + myTable->SetID (aRow, anIO->getEntry() ); } } default: // get a GEOM object @@ -3747,7 +3742,7 @@ void SMESHGUI_FilterDlg::onSelectionDone() if (!anObj->_is_nil()) { myTable->SetThreshold(aRow, GEOMBase::GetName(anObj)); - myTable->SetID(aRow, anIO->getEntry()); + myTable->SetID (aRow, anIO->getEntry()); } } } diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index a2d70b88b..097dd94b7 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -306,6 +306,8 @@ namespace { // - FT_EntityType = 36 // v 7.3.0: FT_Undefined == 46, new items: // - FT_ConnectedElements = 39 + // v 7.6.0: FT_Undefined == 47, new items: + // - FT_BelongToMeshGroup = 22 // // It's necessary to continue recording this history and to fill // undef2newItems (see below) accordingly. @@ -326,6 +328,7 @@ namespace { undef2newItems[ 44 ].push_back( 37 ); undef2newItems[ 45 ].push_back( 36 ); undef2newItems[ 46 ].push_back( 39 ); + undef2newItems[ 47 ].push_back( 22 ); ASSERT( undef2newItems.rbegin()->first == SMESH::FT_Undefined ); } diff --git a/src/SMESH_I/SMESH_Filter_i.cxx b/src/SMESH_I/SMESH_Filter_i.cxx index 7dc847a3e..46a46b18d 100644 --- a/src/SMESH_I/SMESH_Filter_i.cxx +++ b/src/SMESH_I/SMESH_Filter_i.cxx @@ -764,7 +764,7 @@ void BelongToMeshGroup_i::SetGroupID( const char* theID ) // IOR or StoreName CORBA::Object_var obj = SMESH_Gen_i::GetORB()->string_to_object( myID.c_str() ); SetGroup( SMESH::SMESH_GroupBase::_narrow( obj )); } - else if ( strncmp( ":0", myID.c_str(), 2 ) == 0 ) // transient mode + GUI + else if ( strncmp( "0:", myID.c_str(), 2 ) == 0 ) // transient mode + GUI { SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy(); diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index ffc80579d..2389d03b5 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -1615,7 +1615,7 @@ namespace // functions making checks according to SMESH::NB_COMMON_NODES_ENUM bool isMajorityOfNodesCommon(int nbChecked, int nbCommon, int nbNodes, int nbCorners, bool & toStopChecking ) { - return nbCommon >= nbNodes / 2; + return nbCommon >= (nbNodes+1) / 2; } } diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index b85912b6b..07d46509b 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -757,6 +757,13 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): raise ValueError, "Group type mismatches Element type" aCriterion.ThresholdStr = aThreshold.GetName() aCriterion.ThresholdID = salome.orb.object_to_string( aThreshold ) + study = self.GetCurrentStudy() + if study: + so = study.FindObjectIOR( aCriterion.ThresholdID ) + if so: + entry = so.GetID() + if entry: + aCriterion.ThresholdID = entry else: raise TypeError, "The Threshold should be a Mesh Group" elif CritType == FT_RangeOfIds: -- 2.39.2