From: imn Date: Fri, 28 Feb 2014 14:58:28 +0000 (+0400) Subject: 0022364: EDF SMESH: Create Mesh dialog box improvement: hide inapplicable algorithms... X-Git-Tag: V7_4_0a1~49 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e26ffcc005221f12d4ff91e074c4c8464ca044e4;p=modules%2Fsmesh.git 0022364: EDF SMESH: Create Mesh dialog box improvement: hide inapplicable algorithms/hypotheses 0022365: EDF SMESH: Create Mesh dialog box improvement: hide algorithms depending on a mesh type --- diff --git a/src/SMESHGUI/SMESHGUI_MeshDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshDlg.cxx index 30b8dfe33..682673205 100644 --- a/src/SMESHGUI/SMESHGUI_MeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshDlg.cxx @@ -668,5 +668,12 @@ int SMESHGUI_MeshDlg::currentMeshType( ) { return myMeshType->currentIndex( ); } - - +//================================================================================ +/*! + * \brief Set current index types of mesh + */ +//================================================================================ +void SMESHGUI_MeshDlg::setCurrentMeshType( const int theIndex ) +{ + myMeshType->setCurrentIndex( theIndex ); +} diff --git a/src/SMESHGUI/SMESHGUI_MeshDlg.h b/src/SMESHGUI/SMESHGUI_MeshDlg.h index fb3604fbf..2d0cdde74 100644 --- a/src/SMESHGUI/SMESHGUI_MeshDlg.h +++ b/src/SMESHGUI/SMESHGUI_MeshDlg.h @@ -76,6 +76,7 @@ public: int getActiveObject(); void setAvailableMeshType(const QStringList& ); int currentMeshType(); + void setCurrentMeshType( const int ); signals: void hypoSet( const QString& ); diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index 6506d1e0e..626081091 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -688,10 +688,13 @@ void SMESHGUI_MeshOp::selectionDone() myDlg->adjustSize(); readMesh(); } + int curIndex = myDlg->currentMeshType( ); QStringList TypeMeshList; createMeshTypeList( TypeMeshList ); setAvailableMeshType( TypeMeshList ); - setFilteredAlgoData( myMaxShapeDim, myDlg->currentMeshType( )); + curIndex =( curIndex >= TypeMeshList.count() ) ? 0 : curIndex; + myDlg->setCurrentMeshType( curIndex ); + setFilteredAlgoData( myMaxShapeDim, curIndex); } catch ( const SALOME::SALOME_Exception& S_ex ) { @@ -1421,7 +1424,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, // check that algorithms of other dimentions are compatible with // the selected one if ( !algoData ) { // all algos becomes available - if (myDlg->currentMeshType() == MT_ANY) + if (myDlg->currentMeshType() == MT_ANY || aDim == SMESH::DIM_1D || aDim == SMESH::DIM_0D) availableHyps( aDim, Algo, anAvailable, myAvailableHypData[ aDim ][ Algo ]); else{ anAvailable.clear(); diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index 966b5fd81..98b192177 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -1563,15 +1563,23 @@ class Mesh: if not geom: geom = self.mesh.GetShapeToMesh() pass - AssureGeomPublished( self, geom, "shape for %s" % hyp.GetName()) - status = self.mesh.AddHypothesis(geom, hyp) - isAlgo = hyp._narrow( SMESH_Algo ) - hyp_name = GetName( hyp ) + hyp_name = hyp.GetName() + lib_name = hyp.GetLibName() geom_name = "" if geom: - geom_name = GetName( geom ) - TreatHypoStatus( status, hyp_name, geom_name, isAlgo ) - return status + geom_name = geom.GetName() + isApplicable = True + isAlgo = hyp._narrow( SMESH_Algo ) + if self.mesh.HasShapeToMesh(): + isApplicable = self.smeshpyD.IsApplicable(hyp_name, lib_name, geom, not geom.IsSame( self.mesh.GetShapeToMesh() ) ) + if isApplicable: + AssureGeomPublished( self, geom, "shape for %s" % hyp.GetName()) + status = self.mesh.AddHypothesis(geom, hyp) + TreatHypoStatus( status, hyp_name, geom_name, isAlgo ) + return status + else: + TreatHypoStatus( HYP_BAD_GEOMETRY, hyp_name, geom_name, isAlgo ) + return HYP_BAD_GEOMETRY ## Return True if an algorithm of hypothesis is assigned to a given shape # @param hyp a hypothesis to check diff --git a/src/SMESH_SWIG/smesh_algorithm.py b/src/SMESH_SWIG/smesh_algorithm.py index 546b71dda..95ac57220 100644 --- a/src/SMESH_SWIG/smesh_algorithm.py +++ b/src/SMESH_SWIG/smesh_algorithm.py @@ -208,8 +208,7 @@ class Mesh_Algorithm: pass self.subm = mesh.mesh.GetSubMesh(geom, algo.GetName()) self.algo = algo - status = mesh.mesh.AddHypothesis(self.geom, self.algo) - TreatHypoStatus( status, algo.GetName(), name, True ) + status = mesh.AddHypothesis(self.geom, self.algo) return def CompareHyp (self, hyp, args): diff --git a/src/StdMeshers/StdMeshers_Hexa_3D.cxx b/src/StdMeshers/StdMeshers_Hexa_3D.cxx index fd6713187..2ac7cafeb 100644 --- a/src/StdMeshers/StdMeshers_Hexa_3D.cxx +++ b/src/StdMeshers/StdMeshers_Hexa_3D.cxx @@ -760,18 +760,20 @@ bool StdMeshers_Hexa_3D::IsApplicable( const TopoDS_Shape & aShape, bool toCheck if ( !exp0.More() ) return false; for ( ; exp0.More(); exp0.Next() ) { - nbFoundShells = 1; + nbFoundShells = 0; isCurShellApp = false; - for (TopExp_Explorer exp1( exp0.Current(), TopAbs_SHELL ); exp1.More(); exp1.Next(), ++nbFoundShells){ - if ( nbFoundShells == 2 ) { - if ( toCheckAll ) return false; - break; - } - const TopoDS_Shell& shell = TopoDS::Shell(exp1.Current()); - isCurShellApp = SMESH_Block::FindBlockShapes(shell, theVertex0, theVertex1, theShapeIDMap ); - if ( toCheckAll && !isCurShellApp ) return false; - } - if( !toCheckAll && isCurShellApp ) return true; + TopExp_Explorer exp1( exp0.Current(), TopAbs_SHELL ); + for ( ; exp1.More(); exp1.Next(), ++nbFoundShells) + if ( nbFoundShells == 2 ) break; + if ( nbFoundShells == 2){ + if ( toCheckAll ) return false; + continue; + } + exp1.Init( exp0.Current(), TopAbs_SHELL ); + const TopoDS_Shell& shell = TopoDS::Shell(exp1.Current()); + isCurShellApp = SMESH_Block::FindBlockShapes(shell, theVertex0, theVertex1, theShapeIDMap ); + if ( toCheckAll && !isCurShellApp ) return false; + if ( !toCheckAll && isCurShellApp ) return true; } return toCheckAll; }; diff --git a/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx b/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx index f6d39bd3e..ab9594c0e 100644 --- a/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx +++ b/src/StdMeshers/StdMeshers_RadialPrism_3D.cxx @@ -625,7 +625,10 @@ bool StdMeshers_RadialPrism_3D::IsApplicable( const TopoDS_Shape & aShape, bool } shell[ nbShells-1 ] = It.Value(); } - if ( nbShells != 2 ) continue; + if ( nbShells != 2 ) { + if ( toCheckAll ) return false; + continue; + } int nbFaces1 = SMESH_MesherHelper:: Count( shell[0], TopAbs_FACE, 0 ); int nbFaces2 = SMESH_MesherHelper:: Count( shell[1], TopAbs_FACE, 0 );