From 49922d93e3ca7e238564d7dc3ca5767aaf84cf50 Mon Sep 17 00:00:00 2001 From: jfa Date: Mon, 11 Aug 2008 11:00:16 +0000 Subject: [PATCH 1/1] Bug 0016155: EDF PAL 447: If the shape is a Shell, disable 3D tab. --- src/SMESH/SMESH_subMesh.cxx | 5 ++++ src/SMESHGUI/SMESHGUI_MeshOp.cxx | 46 +++++++++++++++++++++++--------- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index 756a76899..644c6fbfa 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -498,6 +498,11 @@ bool SMESH_subMesh::CanAddHypothesis(const SMESH_Hypothesis* theHypothesis) cons { int aHypDim = theHypothesis->GetDim(); int aShapeDim = SMESH_Gen::GetShapeDim(_subShape); + if (aHypDim == 3 && aShapeDim == 3) { + // check case of open shell + if (_subShape.ShapeType() == TopAbs_SHELL && !_subShape.Closed()) + return false; + } if ( aHypDim <= aShapeDim ) return true; diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index 14fed46e8..4d27d31ae 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -61,7 +61,9 @@ #include // OCCT includes +#include #include +#include #include // IDL includes @@ -453,24 +455,42 @@ void SMESHGUI_MeshOp::selectionDone() for (int iss = 0; iss < aSeq->length() && shapeDim < 3; iss++) { GEOM::GEOM_Object_var aGeomVar = aSeq[iss]; switch ( aGeomVar->GetShapeType() ) { - case GEOM::SOLID: - case GEOM::SHELL: shapeDim = 3; break; + case GEOM::SOLID: shapeDim = 3; break; + case GEOM::SHELL: + { + //shapeDim = 3; // Bug 0016155: EDF PAL 447: If the shape is a Shell, disable 3D tab + shapeDim = (shapeDim < 2) ? 2 : shapeDim; + TopoDS_Shape aShape; + if (GEOMBase::GetShape(aGeomVar, aShape)) { + if (aShape.Closed()) + shapeDim = 3; + } + } + break; case GEOM::FACE: shapeDim = (shapeDim < 2) ? 2 : shapeDim; break; case GEOM::WIRE: case GEOM::EDGE: shapeDim = (shapeDim < 1) ? 1 : shapeDim; break; case GEOM::VERTEX: break; default: - TopoDS_Shape aShape; - if ( GEOMBase::GetShape(aGeomVar, aShape)) { - TopExp_Explorer exp( aShape, TopAbs_SHELL ); - if ( exp.More() ) - shapeDim = 3; - else if ( exp.Init( aShape, TopAbs_FACE ), exp.More() ) - shapeDim = (shapeDim < 2) ? 2 : shapeDim; - else if ( exp.Init( aShape, TopAbs_EDGE ), exp.More() ) - shapeDim = (shapeDim < 1) ? 1 : shapeDim; - else - ;//shapeDim = 0; + { + TopoDS_Shape aShape; + if (GEOMBase::GetShape(aGeomVar, aShape)) { + TopExp_Explorer exp (aShape, TopAbs_SHELL); + if (exp.More()) { + //shapeDim = 3; // Bug 0016155: EDF PAL 447: If the shape is a Shell, disable 3D tab + shapeDim = (shapeDim < 2) ? 2 : shapeDim; + for (; exp.More() && shapeDim == 2; exp.Next()) { + if (exp.Current().Closed()) + shapeDim = 3; + } + } + else if ( exp.Init( aShape, TopAbs_FACE ), exp.More() ) + shapeDim = (shapeDim < 2) ? 2 : shapeDim; + else if ( exp.Init( aShape, TopAbs_EDGE ), exp.More() ) + shapeDim = (shapeDim < 1) ? 1 : shapeDim; + else + ;//shapeDim = 0; + } } } } -- 2.39.2