From c18fd9d00c0ebf0fbad0f1ce8861cc67549d83e4 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 21 Jun 2016 14:04:19 +0300 Subject: [PATCH] 53416: SALOME crashes when selecting a sub-menu of Control menu item --- doc/salome/gui/SMESH/input/about_meshes.doc | 6 +- .../gui/SMESH/input/constructing_meshes.doc | 3 + doc/salome/gui/SMESH/input/index.doc | 2 +- .../gui/SMESH/input/max_element_length_2d.doc | 5 +- .../gui/SMESH/input/max_element_length_3d.doc | 6 +- src/SMESHGUI/SMESHGUI.cxx | 60 ++++++++++++------- src/SMESHGUI/SMESHGUI_ComputeDlg.cxx | 6 +- 7 files changed, 52 insertions(+), 36 deletions(-) diff --git a/doc/salome/gui/SMESH/input/about_meshes.doc b/doc/salome/gui/SMESH/input/about_meshes.doc index 003258f37..2795d885e 100644 --- a/doc/salome/gui/SMESH/input/about_meshes.doc +++ b/doc/salome/gui/SMESH/input/about_meshes.doc @@ -35,7 +35,7 @@ Mesh module provides several ways to create the mesh:
  • Bottom-up way, using \ref modifying_meshes_page "mesh modification" operations, especially \ref extrusion_page "extrusion" and \ref - revolution_page "revolution". To create an empty mesh not based on a + revolution_page "revolution". To create an empty mesh not based on geometry, use the same dialog as to \ref constructing_meshes_page "construct the mesh on geometry" but specify neither the geometry nor meshing algorithms. @@ -44,9 +44,9 @@ Mesh module provides several ways to create the mesh: (and exported to) the file in MED, UNV, STL, CGNS, DAT, GMF and SAUVE formats.
  • -
  • The 3D mesh can be generated from the 2D mesh not based on the geometry, +
  • The 3D mesh can be generated from the 2D mesh not based on geometry, which was either \ref importing_exporting_meshes_page "imported" or created in - other way. To setup the meshing parameters of a mesh not based on a geometry, + other way. To setup the meshing parameters of a mesh not based on geometry, just invoke \ref editing_meshes_page "Edit mesh / sub-mesh" command on your 2D mesh.
  • diff --git a/doc/salome/gui/SMESH/input/constructing_meshes.doc b/doc/salome/gui/SMESH/input/constructing_meshes.doc index 2ec8a4987..3a0490c21 100644 --- a/doc/salome/gui/SMESH/input/constructing_meshes.doc +++ b/doc/salome/gui/SMESH/input/constructing_meshes.doc @@ -10,6 +10,9 @@ To create a mesh on geometry, it is necessary to create a mesh object by choosin taken into account by the chosen meshing algorithms. Then you can launch mesh generation by invoking \ref compute_anchor "Compute" command. +The generated mesh will be automatically shown in the Viewer. You can +switch off automatic visualization or limit mesh size until which it is +automatically shown in \ref mesh_preferences_page (Automatic update entry). \note Sometimes \a hypotheses term is used to refer to both algorithms and hypotheses. diff --git a/doc/salome/gui/SMESH/input/index.doc b/doc/salome/gui/SMESH/input/index.doc index 9bcdd7907..e2762515b 100644 --- a/doc/salome/gui/SMESH/input/index.doc +++ b/doc/salome/gui/SMESH/input/index.doc @@ -1,6 +1,6 @@ /*! -\mainpage Introduction to MESH +\mainpage Introduction to Mesh module \image html a-viewgeneral.png diff --git a/doc/salome/gui/SMESH/input/max_element_length_2d.doc b/doc/salome/gui/SMESH/input/max_element_length_2d.doc index 6ec4f7116..e4e2ce9a8 100644 --- a/doc/salome/gui/SMESH/input/max_element_length_2d.doc +++ b/doc/salome/gui/SMESH/input/max_element_length_2d.doc @@ -2,8 +2,9 @@ \page max_element_length_2d_page Element Diameter 2D -\n This quality control criterion consists in calculation of the length of -edges and diagonals combining 2D mesh elements (triangles and quadrangles). +\n This quality control criterion consists in calculation of the maximal length of +edges and diagonals of 2D mesh elements (triangles and quadrangles). For polygons +the value is always zero. To apply the Element Diameter 2D quality criterion to your mesh:
      diff --git a/doc/salome/gui/SMESH/input/max_element_length_3d.doc b/doc/salome/gui/SMESH/input/max_element_length_3d.doc index 7aa70ad7b..837f6aa6f 100644 --- a/doc/salome/gui/SMESH/input/max_element_length_3d.doc +++ b/doc/salome/gui/SMESH/input/max_element_length_3d.doc @@ -2,9 +2,9 @@ \page max_element_length_3d_page Element Diameter 3D -\n This quality control criterion consists in calculation of the length of -edges and diagonals combining 3D mesh elements -(tetrahedrons, pyramids, pentahendrons, hexahedrons and polyhedrons). +\n This quality control criterion consists in calculation of the maximal length of +edges and diagonals of 3D mesh elements (tetrahedrons, pyramids, etc). For polyhedra +the value is always zero. To apply the Element Diameter 3D quality criterion to your mesh:
        diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index ccf68d935..a14b72eed 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -195,7 +195,7 @@ namespace void SetDisplayEntity(int theCommandID); - int ActionToControl( int theID, bool theReversed = false ); + int ActionToControl( int theID, bool theReversed = false ); void Control( int theCommandID ); @@ -265,14 +265,16 @@ namespace filter, QObject::tr( "SMESH_IMPORT_MESH" ) ); } - if ( filenames.count() > 0 ) { + if ( filenames.count() > 0 ) + { SUIT_OverrideCursor wc; _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); QStringList errors; QStringList anEntryList; bool isEmpty = false; - for ( QStringList::ConstIterator it = filenames.begin(); it != filenames.end(); ++it ) { + for ( QStringList::ConstIterator it = filenames.begin(); it != filenames.end(); ++it ) + { QString filename = *it; SMESH::mesh_array_var aMeshes = new SMESH::mesh_array; try { @@ -365,7 +367,8 @@ namespace arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) ); } - for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ ) { + for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ ) + { _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] ); if ( aMeshSO ) { _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder(); @@ -1634,11 +1637,11 @@ namespace void Control( int theCommandID ) { - SMESH_Actor::eControl aControl = SMESH_Actor::eControl( ActionToControl( theCommandID ) ); + SMESH_Actor::eControl aControl = SMESH_Actor::eControl( ActionToControl( theCommandID )); _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); - LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr(); + SALOME_ListIO selected; - if ( aSel ) + if ( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() ) aSel->selectedObjects( selected ); if ( !selected.IsEmpty() ) { @@ -1646,14 +1649,24 @@ namespace for ( ; It.More(); It.Next()) { Handle(SALOME_InteractiveObject) anIO = It.Value(); - if(!anIO.IsNull()){ + if ( !anIO.IsNull() ) { _PTR(SObject) SO = aStudy->FindObjectID( It.Value()->getEntry() ); if ( SO ) { CORBA::Object_var aObject = SMESH::SObjectToObject( SO ); SMESH::SMESH_IDSource_var anIDSrc = SMESH::SMESH_IDSource::_narrow( aObject ); if ( !anIDSrc->_is_nil() ) { - if ( SMESH_Actor *anActor = SMESH::FindActorByEntry( anIO->getEntry()) ) { + SMESH_Actor *anActor = SMESH::FindActorByEntry( anIO->getEntry()); + if (( !anActor && selected.Extent() == 1 ) && + ( anActor = SMESH::CreateActor( aStudy, anIO->getEntry() ))) + { anActor->SetControlMode( aControl ); + SMESH::DisplayActor( SMESH::GetCurrentVtkView(), anActor ); + SMESH::UpdateView ( SMESH::eDisplay, anIO->getEntry() ); + } + if ( anActor ) + { + if ( anActor->GetControlMode() != aControl ) + anActor->SetControlMode( aControl ); QString functorName = functorToString( anActor->GetFunctor() ); anActor->GetScalarBarActor()->SetTitle( functorName.toLatin1().constData() ); SMESH::RepaintCurrentView(); @@ -4148,9 +4161,9 @@ void SMESHGUI::initialize( CAM_Application* app ) createMenu( SMESHOp::OpPropertiesVolume, basicPropId, -1 ); createMenu( SMESHOp::OpUpdate, viewId, -1 ); - connect( nodeMenu, SIGNAL( aboutToShow() ), this, SLOT( onUpdateControlActions() ) ); - connect( edgeMenu, SIGNAL( aboutToShow() ), this, SLOT( onUpdateControlActions() ) ); - connect( faceMenu, SIGNAL( aboutToShow() ), this, SLOT( onUpdateControlActions() ) ); + connect( nodeMenu, SIGNAL( aboutToShow() ), this, SLOT( onUpdateControlActions() ) ); + connect( edgeMenu, SIGNAL( aboutToShow() ), this, SLOT( onUpdateControlActions() ) ); + connect( faceMenu, SIGNAL( aboutToShow() ), this, SLOT( onUpdateControlActions() ) ); connect( volumeMenu, SIGNAL( aboutToShow() ), this, SLOT( onUpdateControlActions() ) ); // ----- create toolbars -------------- @@ -6832,23 +6845,24 @@ void SMESHGUI::onHypothesisEdit( int result ) */ void SMESHGUI::onUpdateControlActions() { - LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr(); SALOME_ListIO selected; - if ( aSel ) + if ( LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr() ) aSel->selectedObjects( selected ); SMESH_Actor::eControl aControl = SMESH_Actor::eNone; if ( selected.Extent() ) { if ( selected.First()->hasEntry() ) { - aControl = SMESH::FindActorByEntry( selected.First()->getEntry() )->GetControlMode(); - SALOME_ListIteratorOfListIO it(selected); - for ( ; it.More(); it.Next() ) { - Handle(SALOME_InteractiveObject) anIO = it.Value(); - if ( anIO->hasEntry() ) { - if ( SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() ) ) { - if ( aControl != anActor->GetControlMode() ) { - aControl = SMESH_Actor::eNone; - break; + if ( SMESH_Actor* anActor = SMESH::FindActorByEntry( selected.First()->getEntry() )) { + aControl = anActor->GetControlMode(); + SALOME_ListIteratorOfListIO it(selected); + for ( it.Next(); it.More(); it.Next() ) { + Handle(SALOME_InteractiveObject) anIO = it.Value(); + if ( anIO->hasEntry() ) { + if ( SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() ) ) { + if ( aControl != anActor->GetControlMode() ) { + aControl = SMESH_Actor::eNone; + break; + } } } } diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index c4de8a507..c7b72d386 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -953,10 +953,8 @@ void SMESHGUI_BaseComputeOp::computeMesh() { SMESH::SMESH_GroupBase_var aGrp = aGroups[i]; if ( CORBA::is_nil( aGrp ) ) continue; - SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp ); - SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp ); - SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp ); - if ( !aStdGroup->_is_nil() ) continue; // don't update the standalone groups + SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp ); + if ( !aStdGroup->_is_nil() ) continue; // don't update standalone groups _PTR(SObject) aGroupSO = SMESH::FindSObject( aGrp ); if ( !aGroupSO ) continue; SMESH::SMESH_IDSource_var aGroupObj =