From 32a86c1f4a05aa4ec91a0a6852914e127438ea6a Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 7 Jul 2010 05:32:15 +0000 Subject: [PATCH] 0020742: EDF 1270 SMESH : Delete Group with contents and remove Orphan Nodes --- .../gui/SMESH/images/remove_nodes_icon.png | Bin 0 -> 720 bytes .../SMESH/images/remove_orphan_nodes_icon.png | Bin 0 -> 807 bytes .../gui/SMESH/images/removeorphannodes.png | Bin 0 -> 8075 bytes .../input/removing_nodes_and_elements.doc | 34 ++++++++++++-- .../gui/SMESH/input/tui_modifying_meshes.doc | 18 +++++++ idl/SMESH_MeshEditor.idl | 25 ++++++++++ resources/Makefile.am | 1 + resources/mesh_rem_orphan_nodes.png | Bin 0 -> 807 bytes src/SMESH/SMESH_MeshEditor.cxx | 8 ++-- src/SMESH/SMESH_MeshEditor.hxx | 2 +- src/SMESHGUI/SMESHGUI.cxx | 44 +++++++++++++++++- src/SMESHGUI/SMESH_images.ts | 4 ++ src/SMESHGUI/SMESH_msg_en.ts | 20 ++++++++ src/SMESH_I/SMESH_2smeshpy.cxx | 2 +- src/SMESH_I/SMESH_MeshEditor_i.cxx | 32 +++++++++++++ src/SMESH_I/SMESH_MeshEditor_i.hxx | 1 + src/SMESH_SWIG/smeshDC.py | 6 +++ 17 files changed, 186 insertions(+), 11 deletions(-) create mode 100644 doc/salome/gui/SMESH/images/remove_nodes_icon.png create mode 100644 doc/salome/gui/SMESH/images/remove_orphan_nodes_icon.png create mode 100644 doc/salome/gui/SMESH/images/removeorphannodes.png create mode 100644 resources/mesh_rem_orphan_nodes.png diff --git a/doc/salome/gui/SMESH/images/remove_nodes_icon.png b/doc/salome/gui/SMESH/images/remove_nodes_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..0818837efc3dd4a7020118d2db74e6a3c2d5cc74 GIT binary patch literal 720 zcmV;>0x$iEP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;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i+0>bS%XK@wzIgnzclU1(b0CWG#_++J*B;Z6lni7X||ppiH1$S{z^Npq^#_5 zBOazvswblylasTdYuhs6>D)^TB=hWW^Kx?-411+-Z*B%==2umnws>3;1`<&Srox6F z*@6CY<49LTI2mZ7nQ|k4P#c82U`9qk@nHNp>3)E}`k~A!Fonlu@$UMxtE=-`Qac9& zFq|3=w;k%}5T%b!XntH_=w5(;Ug&OPSWK~!l$2ybcyT%`9NM$`@)FE2z-Co5dw+Y$ z25Y?oXAvZj_gJZE{ah#rR*+U#S9f;YcK{(~dezV{v$e$r7+F~-hDQ^doqk)C zClZ!zKhy2<;VV8mM`NTAD5~8 z_4V{lPEW6U&JRnMjvfM)X+Es*3K?~NbvxbcsOTL>1wnT{@0b!DtvWP83V)=P0i6kK zJhoG{Y5S>y9;x!|C0w@s)%)CvVDZ-cklYI&40TC$);4Sy(LSeT|2^E*5^Jra^3Bkh z_cQdinYZpX)??IOEezw>cGhFie}}{%g#5d&Z+C~jv206d+%gi5T{D)NS5=or_3!Pl z!tD7xi}j)VKZyTl0PFjT%eM^fe;XI#x116<2EE>c18;n{N-@8n{om-VMy}$We;CCX zNH-JaX-cZT6Wy*}7ZGK{^jJ<9|F#7ZM;erLm#~=rmu{Pl*Z)%2zv{MBL>f9U!no(b zPYA{n!R&Snz>a?ZU2`jVt(=Qg^#9TyPk}LH+yqP-zoQ`j!?`NzbFTFJj
  • \ref removing_nodes_anchor "Nodes"
  • +
  • \ref removing_orphan_nodes_anchor "Orphan Nodes"
  • \ref removing_elements_anchor "Elements"
  • \ref clear_mesh_anchor "Clear Mesh Data"
  • @@ -18,11 +19,11 @@
    1. Select your mesh in the Object Browser or in the 3D viewer.
    2. -
    3. From the Modification menu choose Remove and from the associated -submenu select the Remove nodes, or just click "Remove nodes" +
    4. From the Modification menu choose Remove and from the associated +submenu select the Nodes, or just click "Remove nodes" button in the toolbar. -\image html image88.gif +\image html remove_nodes_icon.png
      "Remove nodes" button
      The following dialog box will appear: @@ -46,6 +47,29 @@ about filters in the \ref selection_filter_library_page "Selection filter librar \note Be careful while removing nodes because if you remove a definite node of your mesh all adjacent elements will be also deleted. +
      +\anchor removing_orphan_nodes_anchor +

      Removing orphan nodes

      + +There is a quick way to remove all the orphan (free) nodes. + +To remove the orphan nodes: +
        +
      1. Select your mesh in the Object Browser or in the 3D viewer.
      2. + +
      3. From the Modification menu choose Remove and from the associated +submenu select the Orphan Nodes, or just click "Remove orphan nodes" +button in the toolbar. + +\image html remove_orphan_nodes_icon.png +
        "Remove orphan nodes" button
        + +The following Warning message box will appear: + +\image html removeorphannodes.png + +Confirm removing nodes by pressing "Yes" button. +
        \anchor removing_elements_anchor

        Removing elements

        @@ -54,8 +78,8 @@ node of your mesh all adjacent elements will be also deleted.
        1. Select your mesh in the Object Browser or in the 3D viewer.
        2. -
        3. From the \b Modification menu choose \b Remove and from the -associated submenu select the Remove elements, or just click +
        4. From the Modification menu choose Remove and from the +associated submenu select the Elements, or just click "Remove elements" button in the toolbar. \image html remove_elements_icon.png diff --git a/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc b/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc index 8eee4e048..fe0da8e61 100644 --- a/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc @@ -281,6 +281,24 @@ if res == 1: print "Elements removing is OK!" else: print "KO Elements removing." \endcode +
          +\anchor tui_removing_orphan_nodes +

          Removing Orphan Nodes

          + +\code +import SMESH_mechanic + +mesh = SMESH_mechanic.mesh + +# add orphan nodes +mesh.AddNode(0,0,0) +mesh.AddNode(1,1,1) +# remove just created orphan nodes +res = mesh.RemoveOrphanNodes() +if res == 1: print "Removed %d nodes!" % res +else: print "KO nodes removing." +\endcode +
          \anchor tui_renumbering_nodes_and_elements

          Renumbering Nodes and Elements

          diff --git a/idl/SMESH_MeshEditor.idl b/idl/SMESH_MeshEditor.idl index 983b2f486..0038beee7 100644 --- a/idl/SMESH_MeshEditor.idl +++ b/idl/SMESH_MeshEditor.idl @@ -37,13 +37,38 @@ module SMESH { /*! * \brief Wrap a sequence of ids in a SMESH_IDSource + * \param IDsOfElements list of mesh elements identifiers + * \return new ID source object */ SMESH_IDSource MakeIDSource(in long_array IDsOfElements); + /*! + * \brief Remove mesh elements specified by their identifiers. + * \param IDsOfElements list of mesh elements identifiers + * \return \c true if elements are correctly removed or \c false otherwise + */ boolean RemoveElements(in long_array IDsOfElements); + /*! + * \brief Remove mesh nodes specified by their identifiers. + * \param IDsOfNodes list of mesh nodes identifiers + * \return \c true if nodes are correctly removed or \c false otherwise + */ boolean RemoveNodes(in long_array IDsOfNodes); + + /*! + * \brief Remove all orphan nodes. + * \return number of removed nodes + */ + long RemoveOrphanNodes(); + /*! + * \brief Add new node. + * \param x X coordinate of new node + * \param y Y coordinate of new node + * \param z Z coordinate of new node + * \return integer identifier of new node + */ long AddNode(in double x, in double y, in double z); /*! diff --git a/resources/Makefile.am b/resources/Makefile.am index 97f2c3b6f..d3407f02e 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -72,6 +72,7 @@ dist_salomeres_DATA = \ mesh_quad.png \ mesh_rem_element.png \ mesh_rem_node.png \ + mesh_rem_orphan_nodes.png \ mesh_shading.png \ mesh_shrink.png \ mesh_skew.png \ diff --git a/resources/mesh_rem_orphan_nodes.png b/resources/mesh_rem_orphan_nodes.png new file mode 100644 index 0000000000000000000000000000000000000000..16df2e592e703b91cdab01683cb9ff4ead85feeb GIT binary patch literal 807 zcmV+?1K9kDP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2igY) z5*ZM2FW5%_000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}0007lNklij?9ygXA$qJJ zFCCIv5Iu!?=^!lSVGzotc3aI+s&#kVSy$QF*P)qhTwRr*|K;O-@4X-Y_kHg@iGNUg zd%Nfzena2oGxWcB$LFu}XbFStMh>ZXaamcJ05DBcDh2Btc+JqQ^IRQ#%lCMc%!bKY zcAe$O46afxWH}&!3TLjZtxfnI{DE~@Fk?N3VPw!gg&FDhQCwN*TM=A-Mr<+S(a0Ha136Qxi`| zuXFaq5jqDaNhg1z&3$0>Q4h+EdxVC2x8+m-$7DGm6eTR0o12AG)z#JFoAF!#;^OVc z0uU`%?%1)UxkIuX5RHwEqFA|HP5@&3{apcw3%*`EZYE5--D2A97Pd=S4hXN;y9t)b zWJD|$6H`-D0uUpw?%T1zk(@w)Q;UmsuCA)8Dw;~A$mjFux=tdIAQp?Uva*7vY54tq zTrL+44Smec4gmaZiUVXT>-BacNfMDr1YOrjCX=L6sRB$ & nodeIDs // Modify a compute state of sub-meshes which become empty //======================================================================= -bool SMESH_MeshEditor::Remove (const list< int >& theIDs, - const bool isNodes ) +int SMESH_MeshEditor::Remove (const list< int >& theIDs, + const bool isNodes ) { myLastCreatedElems.Clear(); myLastCreatedNodes.Clear(); @@ -260,6 +260,7 @@ bool SMESH_MeshEditor::Remove (const list< int >& theIDs, SMESHDS_Mesh* aMesh = GetMeshDS(); set< SMESH_subMesh *> smmap; + int removed = 0; list::const_iterator it = theIDs.begin(); for ( ; it != theIDs.end(); it++ ) { const SMDS_MeshElement * elem; @@ -296,6 +297,7 @@ bool SMESH_MeshEditor::Remove (const list< int >& theIDs, aMesh->RemoveNode( static_cast< const SMDS_MeshNode* >( elem )); else aMesh->RemoveElement( elem ); + removed++; } // Notify sub-meshes about modification @@ -309,7 +311,7 @@ bool SMESH_MeshEditor::Remove (const list< int >& theIDs, // if ( SMESH_subMesh * sm = GetMesh()->GetSubMeshContaining( 1 ) ) // sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); - return true; + return removed; } //======================================================================= diff --git a/src/SMESH/SMESH_MeshEditor.hxx b/src/SMESH/SMESH_MeshEditor.hxx index d9f4b5d28..ee8703ecc 100644 --- a/src/SMESH/SMESH_MeshEditor.hxx +++ b/src/SMESH/SMESH_MeshEditor.hxx @@ -171,7 +171,7 @@ public: const bool isPoly, const int ID = 0); - bool Remove (const std::list< int >& theElemIDs, const bool isNodes); + int Remove (const std::list< int >& theElemIDs, const bool isNodes); // Remove a node or an element. // Modify a compute state of sub-meshes which become empty diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index fe6d90e4c..d672484f3 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -286,7 +286,7 @@ // actually, the following condition can't be met (added for insurance) if( selected.Extent() == 0 || - selected.Extent() > 1 && theCommandID != 122 && theCommandID != 125 ) + ( selected.Extent() > 1 && theCommandID != 122 && theCommandID != 125 ) ) return; bool hasDuplicatedMeshNames = false; @@ -2566,6 +2566,44 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) updateObjBrowser(); break; } + case 4044: // REMOVE ORPHAN NODES + { + if(checkLock(aStudy)) break; + SALOME_ListIO selected; + if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() ) + aSel->selectedObjects( selected ); + if ( selected.Extent() == 1 ) { + Handle(SALOME_InteractiveObject) anIO = selected.First(); + SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(anIO); + if ( !aMesh->_is_nil() ) { + bool confirm = SUIT_MessageBox::question( SMESHGUI::desktop(), + tr( "SMESH_WARNING" ), + tr( "REMOVE_ORPHAN_NODES_QUESTION"), + SUIT_MessageBox::Yes | + SUIT_MessageBox::No, + SUIT_MessageBox::No ) == SUIT_MessageBox::Yes; + if( confirm ) { + try { + SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor(); + int removed = aMeshEditor->RemoveOrphanNodes(); + SUIT_MessageBox::information(SMESHGUI::desktop(), + tr("SMESH_INFORMATION"), + tr("NB_NODES_REMOVED").arg(removed)); + if ( removed > 0 ) { + SMESH::UpdateView(); + SMESHGUI::Modified(); + } + } + catch (const SALOME::SALOME_Exception& S_ex) { + SalomeApp_Tools::QtCatchCorbaException(S_ex); + } + catch (...) { + } + } + } + } + break; + } case 4051: // RENUMBERING NODES { if(checkLock(aStudy)) break; @@ -2974,6 +3012,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( 4032, "HEXA", "ICON_DLG_HEXAS" ); createSMESHAction( 4041, "REMOVE_NODES", "ICON_DLG_REM_NODE" ); createSMESHAction( 4042, "REMOVE_ELEMENTS", "ICON_DLG_REM_ELEMENT" ); + createSMESHAction( 4044, "REMOVE_ORPHAN_NODES", "ICON_DLG_REM_ORPHAN_NODES" ); createSMESHAction( 4043, "CLEAR_MESH" , "ICON_CLEAR_MESH" ); createSMESHAction( 4051, "RENUM_NODES", "ICON_DLG_RENUMBERING_NODES" ); createSMESHAction( 4052, "RENUM_ELEMENTS", "ICON_DLG_RENUMBERING_ELEMENTS" ); @@ -3144,6 +3183,8 @@ void SMESHGUI::initialize( CAM_Application* app ) createMenu( 4041, removeId, -1 ); createMenu( 4042, removeId, -1 ); + createMenu( 4044, removeId, -1 ); + createMenu( separator(), removeId, -1 ); createMenu( 4043, removeId, -1 ); createMenu( 4051, renumId, -1 ); @@ -3243,6 +3284,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createTool( separator(), addRemTb ); createTool( 4041, addRemTb ); createTool( 4042, addRemTb ); + createTool( 4044, addRemTb ); createTool( 4043, addRemTb ); createTool( separator(), addRemTb ); createTool( 4051, addRemTb ); diff --git a/src/SMESHGUI/SMESH_images.ts b/src/SMESHGUI/SMESH_images.ts index 22b3fd7e8..95a9c6881 100644 --- a/src/SMESHGUI/SMESH_images.ts +++ b/src/SMESHGUI/SMESH_images.ts @@ -205,6 +205,10 @@ ICON_DLG_REM_NODE mesh_rem_node.png + + ICON_DLG_REM_ORPHAN_NODES + mesh_rem_orphan_nodes.png + ICON_DLG_RENUMBERING_ELEMENTS mesh_renumbering_elements.png diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index c7ddce707..00d0f4ca9 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -534,6 +534,10 @@ MEN_REMOVE_NODES Nodes + + MEN_REMOVE_ORPHAN_NODES + Orphan Nodes + MEN_RENAME Rename @@ -2457,6 +2461,10 @@ Consider saving your work before application crash STB_REMOVE_NODES Remove nodes + + STB_REMOVE_ORPHAN_NODES + Remove orphan nodes + STB_RENAME Rename @@ -2971,6 +2979,10 @@ Consider saving your work before application crash TOP_REMOVE_NODES Remove nodes + + TOP_REMOVE_ORPHAN_NODES + Remove orphan nodes + TOP_RENAME Rename @@ -3209,6 +3221,14 @@ Do you wish to re-compute the mesh totally to discard the modifications? Input value precision can be adjusted using '%1' parameter in Mesh module preferences. + + REMOVE_ORPHAN_NODES_QUESTION + Do you really want to remove all orphan nodes? + + + NB_NODES_REMOVED + Removed %1 node(s). + SMESHGUI diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 640f51191..76831c29c 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -1096,7 +1096,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand) static TStringSet sameMethods; if ( sameMethods.empty() ) { const char * names[] = { - "RemoveElements","RemoveNodes","AddNode","Add0DElement","AddEdge","AddFace","AddPolygonalFace", + "RemoveElements","RemoveNodes","RemoveOrphanNodes","AddNode","Add0DElement","AddEdge","AddFace","AddPolygonalFace", "AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces","MoveNode", "MoveClosestNodeToPoint", "InverseDiag","DeleteDiag","Reorient","ReorientObject","TriToQuad","SplitQuad","SplitQuadObject", "BestSplit","Smooth","SmoothObject","SmoothParametric","SmoothParametricObject", diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index bde96521a..eefc4372c 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -39,6 +39,7 @@ #include "SMESH_subMesh_i.hxx" #include "SMESH_Group_i.hxx" #include "SMESH_PythonDump.hxx" +#include "SMESH_ControlsDef.hxx" #include "utilities.h" #include "Utils_ExceptHandlers.hxx" @@ -350,6 +351,37 @@ CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH::long_array & IDsOfNo */ //============================================================================= +CORBA::Long SMESH_MeshEditor_i::RemoveOrphanNodes() +{ + initData(); + + ::SMESH_MeshEditor anEditor( myMesh ); + + // Update Python script + TPythonDump() << "nbRemoved = " << this << ".RemoveOrphanNodes()"; + + // Create filter to find all orphan nodes + SMESH::Controls::Filter::TIdSequence seq; + SMESH::Controls::PredicatePtr predicate( new SMESH::Controls::FreeNodes() ); + SMESH::Controls::Filter::GetElementsId( GetMeshDS(), predicate, seq ); + + // remove orphan nodes (if there are any) + list< int > IdList; + for ( int i = 0; i < seq.size(); i++ ) + IdList.push_back( seq[i] ); + + if ( IdList.size() ) + myMesh->SetIsModified( true ); + + return anEditor.Remove( IdList, true ); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + CORBA::Long SMESH_MeshEditor_i::AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z) { diff --git a/src/SMESH_I/SMESH_MeshEditor_i.hxx b/src/SMESH_I/SMESH_MeshEditor_i.hxx index 046573b17..f5bebdc0a 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.hxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.hxx @@ -56,6 +56,7 @@ public: CORBA::Boolean RemoveElements(const SMESH::long_array & IDsOfElements); CORBA::Boolean RemoveNodes(const SMESH::long_array & IDsOfNodes); + CORBA::Long RemoveOrphanNodes(); /*! * Methods for creation new elements. diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index de8f32624..693b1c3a8 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshDC.py @@ -2160,6 +2160,12 @@ class Mesh: def RemoveNodes(self, IDsOfNodes): return self.editor.RemoveNodes(IDsOfNodes) + ## Removes all orphan (free) nodes from mesh + # @return number of the removed nodes + # @ingroup l2_modif_del + def RemoveOrphanNodes(self): + return self.editor.RemoveOrphanNodes() + ## Add a node to the mesh by coordinates # @return Id of the new node # @ingroup l2_modif_add -- 2.39.2