From: jfa Date: Wed, 19 Jul 2023 15:38:00 +0000 (+0100) Subject: Merge branch 'V9_11_BR' X-Git-Tag: V9_12_0a1~14 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=e0552dbb7fcfd574db628a4e44b5e13fca6799f5;hp=120207d740662965e1ca6dfe8325d1e7edad0e73 Merge branch 'V9_11_BR' --- diff --git a/doc/examples/create_dual_mesh.py b/doc/examples/create_dual_mesh.py index d65e9bd16..97d827a9a 100644 --- a/doc/examples/create_dual_mesh.py +++ b/doc/examples/create_dual_mesh.py @@ -48,11 +48,17 @@ isDone = Mesh_1.Compute() if not isDone: raise Exception("Error when computing Mesh") -# Creating Dual mesh +# Creating Dual mesh with projection on shape dual_Mesh_1 = smesh.CreateDualMesh( Mesh_1, 'dual_Mesh_1', True) assert(dual_Mesh_1.NbPolyhedrons() > 0) assert(dual_Mesh_1.NbTetras() == 0) +# Creating Dual mesh withour projection on shape +dual_Mesh_2 = smesh.CreateDualMesh( Mesh_1, 'dual_Mesh_2', False) + +assert(dual_Mesh_2.NbPolyhedrons() > 0) +assert(dual_Mesh_2.NbTetras() == 0) + if salome.sg.hasDesktop(): salome.sg.updateObjBrowser() diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx index eeabfd29d..a86dddff2 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx @@ -645,6 +645,7 @@ namespace SMESH try { CORBA::String_var error; res = aMesh->AddHypothesis(aShapeObject, aHyp, error.out()); + UpdateViewer(aMesh); if (res > SMESH::HYP_OK) { wc.suspend(); processHypothesisStatus(res, aHyp, true, error.in() ); @@ -676,6 +677,7 @@ namespace SMESH { CORBA::String_var error; res = aMesh->AddHypothesis( aShapeObject, aHyp, error.out() ); + UpdateViewer(aMesh); if (res > SMESH::HYP_OK) { wc.suspend(); processHypothesisStatus( res, aHyp, true, error.in() ); @@ -764,12 +766,7 @@ namespace SMESH processHypothesisStatus(res, anHyp, false); wc.resume(); } - if ( _PTR(SObject) meshSO = SMESH::FindSObject(aMesh) ) - { - if ( SMESH_Actor* actor = SMESH::FindActorByEntry( meshSO->GetID().c_str() )) - if( actor->GetVisibility() ) - actor->Update(); - } + UpdateViewer(aMesh); } } catch(const SALOME::SALOME_Exception& S_ex) { wc.suspend(); @@ -778,6 +775,16 @@ namespace SMESH } } return res < SMESH::HYP_UNKNOWN_FATAL; + } + + void UpdateViewer(SMESH::SMESH_Mesh_ptr theMesh) + { + if (_PTR(SObject) meshSO = SMESH::FindSObject(theMesh)) + { + if (SMESH_Actor* actor = SMESH::FindActorByEntry(meshSO->GetID().c_str())) + if (actor->GetVisibility()) + actor->Update(); + } } SObjectList GetMeshesUsingAlgoOrHypothesis(SMESH::SMESH_Hypothesis_ptr AlgoOrHyp) diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.h b/src/SMESHGUI/SMESHGUI_HypothesesUtils.h index 8e98e2876..20d7eccc6 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.h +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.h @@ -115,6 +115,8 @@ namespace SMESH bool RemoveHypothesisOrAlgorithmOnMesh( _PTR(SObject), SMESH::SMESH_Hypothesis_ptr ); + SMESHGUI_EXPORT void UpdateViewer(SMESH::SMESH_Mesh_ptr); + typedef std::vector<_PTR(SObject)> SObjectList; SMESHGUI_EXPORT SObjectList GetMeshesUsingAlgoOrHypothesis( SMESH::SMESH_Hypothesis_ptr ); diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index d1b4b6cce..95b51a474 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -158,7 +158,7 @@ bool SMESHGUI_MeshOp::onApply() if (( myToCreate && !myIsMesh ) || myIsInvalidSubMesh ) aResult = createSubMesh( aMess, anEntryList ); else if ( !myToCreate ) - aResult = editMeshOrSubMesh( aMess ); + aResult = editMeshOrSubMesh( aMess, anEntryList ); if ( aResult ) { SMESHGUI::Modified(); @@ -2577,13 +2577,14 @@ int SMESHGUI_MeshOp::find( const SMESH::SMESH_Hypothesis_var& theHyp, //================================================================================ /*! * \brief Edits mesh or sub-mesh - * \param theMess - Output parameter intended for returning error message - * \retval bool - TRUE if mesh is edited successfully, FALSE otherwise + * \param theMess - Output parameter intended for returning error message + * \param theEntryList - List of entries of published objects + * \retval bool - TRUE if mesh is edited successfully, FALSE otherwise * * Assigns new name hypotheses and algorithms to the mesh or sub-mesh */ //================================================================================ -bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess ) +bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess, QStringList& theEntryList) { theMess = ""; @@ -2628,6 +2629,12 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess ) if ( !isMesh && !aSubMeshVar->_is_nil() ) aMesh = aSubMeshVar->GetFather(); + _PTR(SObject) aMeshSO = SMESH::FindSObject(aMesh.in()); + if (aMeshSO) { + SMESH::SetName(aMeshSO, myDlg->objectText(SMESHGUI_MeshDlg::Obj)); + theEntryList.append(aMeshSO->GetID().c_str()); + } + // Assign new algorithms and hypotheses for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ ) { diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.h b/src/SMESHGUI/SMESHGUI_MeshOp.h index cf55cf346..a4fbeb3ea 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.h +++ b/src/SMESHGUI/SMESHGUI_MeshOp.h @@ -120,7 +120,7 @@ private: bool createMesh( QString&, QStringList& ); bool createSubMesh( QString&, QStringList& ); - bool editMeshOrSubMesh( QString& ); + bool editMeshOrSubMesh( QString&, QStringList& ); void createSubMeshOnInternalEdges( SMESH::SMESH_Mesh_ptr mesh, GEOM::GEOM_Object_ptr mainShape ); bool checkSubMeshConcurrency( SMESH::SMESH_Mesh_ptr mesh, diff --git a/src/SMESH_SWIG/smesh_tools.py b/src/SMESH_SWIG/smesh_tools.py index 19d9fb6fd..b964f55ea 100644 --- a/src/SMESH_SWIG/smesh_tools.py +++ b/src/SMESH_SWIG/smesh_tools.py @@ -195,7 +195,7 @@ def smesh_create_dual_mesh(mesh_ior, output_file, adapt_to_shape=True, id_grp_poly, nodes_added_on_tri = \ __getIdsGrpDualFromOrig(mc_mesh_file, grp_name, mesh2d, -1) - if id_grp_poly is not None and grp_name[:4] == __prefix: + if id_grp_poly is not None and grp_name[:4] == __prefix and adapt_to_shape: # This group is on a specific geom face face_id = grp_name.split("_")[-1] face_id = int(face_id)