From: adv Date: Thu, 5 Dec 2013 05:23:48 +0000 (+0000) Subject: Export of empty calculation case corrected (Bug #171). X-Git-Tag: BR_hydro_v_0_4~40 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aee8a946d0c86a5b3d8aa4cb40406189ac19b952;p=modules%2Fhydro.git Export of empty calculation case corrected (Bug #171). --- diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index c93052c8..e3c40801 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -426,29 +426,32 @@ TopoDS_Shell HYDROData_CalculationCase::GetShell() aSewing.Perform(); TopoDS_Shape aSewedShape = aSewing.SewedShape(); - if ( aSewedShape.ShapeType() == TopAbs_FACE && aCaseRegions.Length() ==1 ) { - // create shell from one face - BRep_Builder aBuilder; - aBuilder.MakeShell( aShell ); - aBuilder.Add( aShell, aSewedShape); - } else { - TopExp_Explorer anExpShells( aSewedShape, TopAbs_SHELL ); - Standard_Integer aNbOfShells = 0; - for ( ; anExpShells.More(); anExpShells.Next() ) { - aShell = TopoDS::Shell( anExpShells.Current() ); - aNbOfShells++; - } - - if ( aNbOfShells != 1 ) { - aShell.Nullify(); + if ( !aSewedShape.IsNull() ) + { + if ( aSewedShape.ShapeType() == TopAbs_FACE && aCaseRegions.Length() ==1 ) { + // create shell from one face BRep_Builder aBuilder; aBuilder.MakeShell( aShell ); + aBuilder.Add( aShell, aSewedShape); + } else { + TopExp_Explorer anExpShells( aSewedShape, TopAbs_SHELL ); + Standard_Integer aNbOfShells = 0; + for ( ; anExpShells.More(); anExpShells.Next() ) { + aShell = TopoDS::Shell( anExpShells.Current() ); + aNbOfShells++; + } - TopExp_Explorer anExpFaces( aSewedShape, TopAbs_FACE ); - for ( ; anExpFaces.More(); anExpFaces.Next() ) { - TopoDS_Face aFace = TopoDS::Face( anExpFaces.Current() ); - if ( !aFace.IsNull() ) { - aBuilder.Add( aShell, aFace ); + if ( aNbOfShells != 1 ) { + aShell.Nullify(); + BRep_Builder aBuilder; + aBuilder.MakeShell( aShell ); + + TopExp_Explorer anExpFaces( aSewedShape, TopAbs_FACE ); + for ( ; anExpFaces.More(); anExpFaces.Next() ) { + TopoDS_Face aFace = TopoDS::Face( anExpFaces.Current() ); + if ( !aFace.IsNull() ) { + aBuilder.Add( aShell, aFace ); + } } } } diff --git a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx index 6344eddd..77722af3 100644 --- a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx @@ -80,7 +80,7 @@ bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags, HYDROGUI_Tool::GetSelectedObject( module() ) ); if ( aCalculation.IsNull() ) { - theErrorMsg = tr( "EXPORT_FAILED" ); + theErrorMsg = tr( "NULL_DATA_OBJECT" ); return false; } @@ -125,16 +125,12 @@ bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags, anIsOk = true; } } - } else { - anErrorMsg = tr( "RESULT_SHAPE_NULL" ); - } - if ( !anIsOk ) { - theErrorMsg = tr( "EXPORT_FAILED" ); + if ( !anIsOk ) + theErrorMsg = tr( "IMPOSSIBLE_TO_CREATE_GEOM_SHAPE" ); - if( !anErrorMsg.isEmpty() ) { - theErrorMsg.prepend( anErrorMsg + "\n" ); - } + } else { + theErrorMsg = tr( "RESULT_SHAPE_NULL" ); } return anIsOk; @@ -176,13 +172,14 @@ void HYDROGUI_ExportCalculationOp::onApply() } else { abort(); - QString aMsg = tr( "EXPORT_FAILED" ); - /* TODO: improve error processing - if( !anErrorMsg.isEmpty() ) - aMsg.prepend( anErrorMsg + "\n" ); - */ + + if ( anErrorMsg.isEmpty() ) + anErrorMsg = tr( "EXPORT_DATA_FAILED" ); + + anErrorMsg.prepend( tr( "EXPORT_FAILED" ) + "\n" ); + SUIT_MessageBox::critical( module()->getApp()->desktop(), tr( "EXPORT_STATUS" ), - aMsg ); + anErrorMsg ); } } \ No newline at end of file diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index 5999f7ef..fe2d0936 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -1399,11 +1399,23 @@ file cannot be correctly imported for an Obstacle definition. EXPORT_FAILED - Export failed. + Export of calculation case failed: + + + EXPORT_DATA_FAILED + parameters of calculation case is invalid. + + + NULL_DATA_OBJECT + data model object is null pointer. RESULT_SHAPE_NULL - Export failed: result shape is null. + shape of calculation case regions is empty. + + + IMPOSSIBLE_TO_CREATE_GEOM_SHAPE + something was wrong during publishing of GEOM shape. OBJ_PREFIX