From 1a1cf7152fa616a5192923c5cc7384f67c9b986c Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 30 Aug 2012 07:42:09 +0000 Subject: [PATCH] 0021823: [CEA 649] Compute failed without any errors report a warning if no elements are assigned to a sub-shape --- src/SMESH/SMESH_subMesh.cxx | 17 ++++++++++++++--- src/SMESHGUI/SMESHGUI_ComputeDlg.cxx | 20 +++++++++++--------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index afaa256ec..aa1bfc5ca 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -1758,13 +1758,25 @@ bool SMESH_subMesh::checkComputeError(SMESH_Algo* theAlgo, const TopoDS_Shape& t } } { - // Check my state + + // Set my _computeState + + _computeState = FAILED_TO_COMPUTE; if ( !_computeError || _computeError->IsOK() ) { // no error description is set to this sub-mesh, check if any mesh is computed _computeState = IsMeshComputed() ? COMPUTE_OK : FAILED_TO_COMPUTE; + if ( _computeState != COMPUTE_OK ) + { + if ( _subShape.ShapeType() == TopAbs_EDGE && + BRep_Tool::Degenerated( TopoDS::Edge( _subShape )) ) + _computeState = COMPUTE_OK; + else + _computeError = SMESH_ComputeError::New(COMPERR_NO_MESH_ON_SHAPE,"",theAlgo); + } + noErrors = ( _computeState == COMPUTE_OK ); } - else + if ( !noErrors ) { if ( !_computeError->myAlgo ) _computeError->myAlgo = theAlgo; @@ -1783,7 +1795,6 @@ bool SMESH_subMesh::checkComputeError(SMESH_Algo* theAlgo, const TopoDS_Shape& t _computeState = _computeError->IsKO() ? FAILED_TO_COMPUTE : COMPUTE_OK; - noErrors = false; } } return noErrors; diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index 07646ef9a..bb931e3dd 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -337,15 +337,16 @@ namespace SMESH { QString text; switch ( errCode ) { - CASE2TEXT( COMPERR_OK ); - CASE2TEXT( COMPERR_BAD_INPUT_MESH); - CASE2TEXT( COMPERR_STD_EXCEPTION ); - CASE2TEXT( COMPERR_OCC_EXCEPTION ); + CASE2TEXT( COMPERR_OK ); + CASE2TEXT( COMPERR_BAD_INPUT_MESH ); + CASE2TEXT( COMPERR_STD_EXCEPTION ); + CASE2TEXT( COMPERR_OCC_EXCEPTION ); case SMESH::COMPERR_SLM_EXCEPTION: break; // avoid double "Salome exception" - CASE2TEXT( COMPERR_EXCEPTION ); - CASE2TEXT( COMPERR_MEMORY_PB ); - CASE2TEXT( COMPERR_BAD_SHAPE ); - CASE2TEXT( COMPERR_CANCELED ); + CASE2TEXT( COMPERR_EXCEPTION ); + CASE2TEXT( COMPERR_MEMORY_PB ); + CASE2TEXT( COMPERR_BAD_SHAPE ); + CASE2TEXT( COMPERR_CANCELED ); + CASE2TEXT( COMPERR_NO_MESH_ON_SHAPE ); case SMESH::COMPERR_ALGO_FAILED: if ( strlen(comment) == 0 ) text = QObject::tr("COMPERR_ALGO_FAILED"); @@ -951,7 +952,8 @@ void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack, { bool onlyWarnings = !theNoCompError; // == valid mesh computed but there are errors reported for ( int i = 0; i < theCompErrors->length() && onlyWarnings; ++i ) - onlyWarnings = ( theCompErrors[ i ].code == SMESH::COMPERR_WARNING ); + onlyWarnings = ( theCompErrors[ i ].code == SMESH::COMPERR_WARNING || + theCompErrors[ i ].code == SMESH::COMPERR_NO_MESH_ON_SHAPE ); // full or brief mesh info SMESH::long_array_var aRes = myMesh->GetMeshInfo(); -- 2.39.2