From 9b1447dccafc543759e3b6b50c10c72e13a37895 Mon Sep 17 00:00:00 2001 From: mpa Date: Fri, 3 Feb 2017 16:17:42 +0300 Subject: [PATCH] Deleted Study parameter --- doc/salome/examples/ghs3d_enfmesh.py | 4 ++-- doc/salome/examples/ghs3d_enfvert.py | 4 ++-- doc/salome/examples/ghs3ddemo.py | 4 ++-- src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx | 14 +++----------- src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx | 2 -- src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx | 15 +++++++-------- 6 files changed, 16 insertions(+), 27 deletions(-) diff --git a/doc/salome/examples/ghs3d_enfmesh.py b/doc/salome/examples/ghs3d_enfmesh.py index b6ca8ec..ab07434 100644 --- a/doc/salome/examples/ghs3d_enfmesh.py +++ b/doc/salome/examples/ghs3d_enfmesh.py @@ -31,11 +31,11 @@ import salome salome.salome_init() import GEOM from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() import SMESH, SALOMEDS from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() box = geompy.MakeBoxDXDYDZ(200, 200, 200) geompy.addToStudy( box, "box" ) diff --git a/doc/salome/examples/ghs3d_enfvert.py b/doc/salome/examples/ghs3d_enfvert.py index f8ba666..75ed204 100644 --- a/doc/salome/examples/ghs3d_enfvert.py +++ b/doc/salome/examples/ghs3d_enfvert.py @@ -33,11 +33,11 @@ import salome salome.salome_init() from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() import SMESH from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() # create a box box = geompy.MakeBoxDXDYDZ(200., 200., 200.) diff --git a/doc/salome/examples/ghs3ddemo.py b/doc/salome/examples/ghs3ddemo.py index 4147812..f28de37 100644 --- a/doc/salome/examples/ghs3ddemo.py +++ b/doc/salome/examples/ghs3ddemo.py @@ -21,10 +21,10 @@ import salome salome.salome_init() from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() # create a box box = geompy.MakeBoxDXDYDZ(200., 200., 200.) diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx index 07620bb..daad213 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx @@ -144,13 +144,6 @@ GHS3DPlugin_GHS3D::GHS3DPlugin_GHS3D(int hypId, SMESH_Gen* gen) _compatibleHypothesis.push_back( GHS3DPlugin_Hypothesis::GetHypType()); _compatibleHypothesis.push_back( StdMeshers_ViscousLayers::GetHypType() ); _requireShape = false; // can work without shape - - _smeshGen_i = SMESH_Gen_i::GetSMESHGen(); - CORBA::Object_var anObject = _smeshGen_i->GetNS()->Resolve("/Study"); - _study = SALOMEDS::Study::_narrow(anObject); - - if (!_study->_is_nil()) - MESSAGE("Study not empty"); _computeCanceled = false; _progressAdvance = 1e-4; @@ -217,18 +210,17 @@ bool GHS3DPlugin_GHS3D::CheckHypothesis ( SMESH_Mesh& aMesh, TopoDS_Shape GHS3DPlugin_GHS3D::entryToShape(std::string entry) { MESSAGE("GHS3DPlugin_GHS3D::entryToShape "<_is_nil() ) - throw SALOME_Exception("MG-Tetra plugin can't work w/o publishing in the study"); + GEOM::GEOM_Object_var aGeomObj; TopoDS_Shape S = TopoDS_Shape(); - SALOMEDS::SObject_var aSObj = _study->FindObjectID( entry.c_str() ); + SALOMEDS::SObject_var aSObj = SMESH_Gen_i::getStudyServant()->FindObjectID( entry.c_str() ); if (!aSObj->_is_nil() ) { CORBA::Object_var obj = aSObj->GetObject(); aGeomObj = GEOM::GEOM_Object::_narrow(obj); aSObj->UnRegister(); } if ( !aGeomObj->_is_nil() ) - S = _smeshGen_i->GeomObjectToShape( aGeomObj.in() ); + S = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( aGeomObj.in() ); return S; } diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx index def1503..a52924f 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx @@ -96,8 +96,6 @@ private: bool _keepFiles; bool _removeLogOnSuccess; bool _logInStandardOutput; - SALOMEDS::Study_var _study; - SMESH_Gen_i* _smeshGen_i; bool _isLibUsed; double _progressAdvance; diff --git a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx index 4ffc77c..051b403 100644 --- a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx @@ -309,14 +309,13 @@ GHS3DPluginGUI_HypothesisCreator::~GHS3DPluginGUI_HypothesisCreator() } /** - * \brief {Get or create the geom selection tool for active study} + * \brief {Get or create the geom selection tool for study} * */ GeomSelectionTools* GHS3DPluginGUI_HypothesisCreator::getGeomSelectionTool() { GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this; - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); - if (that->GeomToolSelected == NULL || that->GeomToolSelected->getMyStudy() != aStudy) { - that->GeomToolSelected = new GeomSelectionTools(aStudy); + if (that->GeomToolSelected == NULL) { + that->GeomToolSelected = new GeomSelectionTools(); } return that->GeomToolSelected; } @@ -1153,7 +1152,7 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh() int elementType = myEnfMeshConstraint->currentIndex(); - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); + _PTR(Study) aStudy = SMESH::getStudy(); _PTR(SObject) aSObj; //SMESH::SMESH_IDSource::_nil; QString meshEntry = myEnfMeshWdg->GetValue(); MESSAGE("myEnfMeshWdg->GetValue()" << meshEntry.toStdString()); @@ -1164,7 +1163,7 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh() // myEnfMesh = myEnfMeshWdg->GetObject< SMESH::SMESH_IDSource >(); // std::string entry = myEnfMeshWdg->GetValue(); aSObj = aStudy->FindObjectID(meshEntry.toStdString().c_str()); - CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy); + CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj); if (!CORBA::is_nil(anObj)) { // SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface( aSObj ); addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName); @@ -1177,7 +1176,7 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh() QStringListIterator meshEntriesIt (meshEntries); while (meshEntriesIt.hasNext()) { aSObj = aStudy->FindObjectID(meshEntriesIt.next().toStdString().c_str()); - CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy); + CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj); if (!CORBA::is_nil(anObj)) { // SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface( aSObj ); addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName); @@ -1787,7 +1786,7 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD TEnfMeshList::const_iterator itEnfMesh; - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); + _PTR(Study) aStudy = SMESH::getStudy(); for(itEnfMesh = h_data.myEnforcedMeshes.begin() ; itEnfMesh != h_data.myEnforcedMeshes.end(); itEnfMesh++ ) { TEnfMesh* enfMesh = (*itEnfMesh); -- 2.39.2