From f02c3a1b9eca50c641a58b401496bc5385bed0e0 Mon Sep 17 00:00:00 2001 From: dmv Date: Wed, 22 Jul 2009 07:33:31 +0000 Subject: [PATCH] IPAL21265 It's impossible to select edge for Reverce in Arithmetic 1D Hypothesis when Edit Mesh --- src/SMESHGUI/SMESHGUI_MeshOp.cxx | 36 +++++++++++-------- .../StdMeshersGUI_EdgeDirectionParamWdg.cxx | 2 +- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index f34871254..35dcb43ba 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -1066,14 +1066,17 @@ void SMESHGUI_MeshOp::createHypothesis (const int theDim, int obj = myDlg->getActiveObject(); removeCustomFilters(); // Issue 0020170 - // Set Geometry - QStringList aList; - myDlg->selectedObject( SMESHGUI_MeshDlg::Geom, aList ); - if (aList.count() != 0) - aCreator->setShapeEntry( aList.first() ); - else - aCreator->setShapeEntry( QString() ); - + // Get Entry of the Geom object + QString anObjEntry = ""; + anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom ); + if ( anObjEntry == "" ) { + anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ); + _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() ); + GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj ); + anObjEntry = aGeomVar->GetStudyEntry(); + } + + aCreator->setShapeEntry( anObjEntry ); myDlg->setEnabled( false ); aCreator->create(initParamHyp, aHypName, myDlg); onActivateObject( obj ); // Issue 0020170. Restore filters @@ -1129,14 +1132,17 @@ void SMESHGUI_MeshOp::onEditHyp( const int theHypType, const int theIndex ) getInitParamsHypothesis( aHyp->GetName(), aHyp->GetLibName()); aCreator->setInitParamsHypothesis( initParamHyp ); - // Set Geometry - QStringList aList; - myDlg->selectedObject( SMESHGUI_MeshDlg::Geom, aList ); - if (aList.count() > 0) - aCreator->setShapeEntry( aList.first() ); - else - aCreator->setShapeEntry( "" ); + // Get Entry of the Geom object + QString anObjEntry = ""; + anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom ); + if ( anObjEntry == "" ) { + anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ); + _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() ); + GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj ); + anObjEntry = aGeomVar->GetStudyEntry(); + } + aCreator->setShapeEntry( anObjEntry ); int obj = myDlg->getActiveObject(); removeCustomFilters(); // Issue 0020170 myDlg->setEnabled( false ); diff --git a/src/StdMeshersGUI/StdMeshersGUI_EdgeDirectionParamWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_EdgeDirectionParamWdg.cxx index 01b64b3a4..89c4ca47a 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_EdgeDirectionParamWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_EdgeDirectionParamWdg.cxx @@ -201,7 +201,7 @@ void StdMeshersGUI_EdgeDirectionParamWdg::SelectionIntoArgument() if ( !CORBA::is_nil( aGeomFatherObj ) ) { // Get Main Shape GEOM::GEOM_Object_var aGeomMain = GetGeomObjectByEntry( myEntry ); - if ( !CORBA::is_nil( aGeomMain ) || aGeomMain->GetType() == 37 ) { // Main Shape is a Group + if ( !CORBA::is_nil( aGeomMain ) && aGeomMain->GetType() == 37 ) { // Main Shape is a Group GEOM::GEOM_Object_ptr aMainFatherObj = aGeomMain->GetMainShape(); if ( !CORBA::is_nil( aMainFatherObj ) ) aMainFatherEntry = aMainFatherObj->GetStudyEntry();