From 9db15b966ab2a7ff953ca3a59401a395defc8173 Mon Sep 17 00:00:00 2001 From: mpa Date: Fri, 3 Feb 2017 16:17:05 +0300 Subject: [PATCH] Deleted Study parameter --- doc/salome/examples/blsurfdemo.py | 4 ++-- doc/salome/examples/test_periodicity_precad.py | 6 +++--- src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx | 10 ++-------- src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx | 2 -- src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx | 6 ++---- src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx | 9 +++------ tests/test_enforced_internal_vertex.py | 6 +++--- tests/test_enforced_vertex.py | 6 +++--- tests/test_periodicity_2D_precad.py | 6 +++--- tests/test_periodicity_precad.py | 6 +++--- tests/test_periodicity_reflexion_2D_precad.py | 6 +++--- tests/test_periodicity_reflexion_precad.py | 6 +++--- tests/test_periodicity_with_points_2D_precad.py | 6 +++--- tests/test_precad_intersections.py | 9 ++++----- tests/test_precad_keep_gaps.py | 9 ++++----- tests/test_proximity.py | 7 +++---- tests/test_quadrangles_gradation.py | 6 +++--- tests/test_remove_tiny_edges.py | 6 +++--- tests/test_sphere.py | 9 ++++----- 19 files changed, 54 insertions(+), 71 deletions(-) diff --git a/doc/salome/examples/blsurfdemo.py b/doc/salome/examples/blsurfdemo.py index 75221c1..4d98941 100644 --- a/doc/salome/examples/blsurfdemo.py +++ b/doc/salome/examples/blsurfdemo.py @@ -6,11 +6,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() # create a box box = geompy.MakeBoxDXDYDZ(200., 200., 200.) diff --git a/doc/salome/examples/test_periodicity_precad.py b/doc/salome/examples/test_periodicity_precad.py index c15afcb..f901cc1 100644 --- a/doc/salome/examples/test_periodicity_precad.py +++ b/doc/salome/examples/test_periodicity_precad.py @@ -5,7 +5,7 @@ import math import GEOM from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() simple = False @@ -90,7 +90,7 @@ geompy.addToStudyInFather(part, sources, "sources") import SMESH from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() Mesh = smesh.Mesh(part, "Mesh") @@ -136,5 +136,5 @@ checkProjection(gr_right, left_translated) checkProjection(gr_back, front_translated) checkProjection(gr_top, bottom_translated) -salome.sg.updateObjBrowser(True) +salome.sg.updateObjBrowser() diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx index 568f3dd..434b732 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx @@ -252,12 +252,6 @@ BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF(int hypId, SMESH_Gen* gen) _hypothesis = NULL; _supportSubmeshes = true; - smeshGen_i = SMESH_Gen_i::GetSMESHGen(); - CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/Study"); - myStudy = SALOMEDS::Study::_narrow(anObject); - if ( !myStudy->_is_nil() ) - MESSAGE("myStudy not empty"); - /* Initialize the Python interpreter */ assert(Py_IsInitialized()); PyGILState_STATE gstate; @@ -439,14 +433,14 @@ TopoDS_Shape BLSURFPlugin_BLSURF::entryToShape(std::string entry) MESSAGE("BLSURFPlugin_BLSURF::entryToShape "<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/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx index bd51354..e87d33e 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx @@ -158,8 +158,6 @@ class BLSURFPlugin_BLSURF: public SMESH_2D_Algo { PyObject * main_mod; PyObject * main_dict; SMESH_Mesh* myMesh; - SALOMEDS::Study_var myStudy; - SMESH_Gen_i* smeshGen_i; volatile bool _compute_canceled; }; diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx index cf5f574..12d12bf 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx @@ -246,18 +246,16 @@ TopoDS_Shape BLSURFPlugin_Hypothesis::entryToShape(std::string entry) { MESSAGE("BLSURFPlugin_Hypothesis::entryToShape "<GetStudy(); TopoDS_Shape S = TopoDS_Shape(); - SALOMEDS::SObject_var aSObj = myStudy->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/GUI/BLSURFPluginGUI_HypothesisCreator.cxx b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx index 7d9341d..d28d036 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx @@ -478,9 +478,8 @@ BLSURFPluginGUI_HypothesisCreator::~BLSURFPluginGUI_HypothesisCreator() GeomSelectionTools* BLSURFPluginGUI_HypothesisCreator::getGeomSelectionTool() const { BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_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; } @@ -3384,10 +3383,8 @@ LightApp_SelectionMgr* BLSURFPluginGUI_HypothesisCreator::selectionMgr() CORBA::Object_var BLSURFPluginGUI_HypothesisCreator::entryToObject(QString entry) { - SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen(); - SALOMEDS::Study_var myStudy = smeshGen_i->GetStudy(); CORBA::Object_var obj; - SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.toStdString().c_str() ); + SALOMEDS::SObject_var aSObj = SMESH_Gen_i::getStudyServant()->FindObjectID( entry.toStdString().c_str() ); if (!aSObj->_is_nil()) { obj = aSObj->GetObject(); aSObj->UnRegister(); diff --git a/tests/test_enforced_internal_vertex.py b/tests/test_enforced_internal_vertex.py index 5459def..574101d 100644 --- a/tests/test_enforced_internal_vertex.py +++ b/tests/test_enforced_internal_vertex.py @@ -5,7 +5,7 @@ import math import GEOM from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() r = 10 dist = 10 @@ -31,7 +31,7 @@ geompy.addToStudyInFather(box, left, "left") import SMESH from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() Mesh = smesh.Mesh(part, "Mesh") @@ -50,5 +50,5 @@ x, y, z = Mesh.GetNodeXYZ(id_node) assert("%.2f, %.2f, %.2f"%(x, y, z) == "%.2f, %.2f, %.2f"%(dist_coin, 0, dist_coin)) -salome.sg.updateObjBrowser(True) +salome.sg.updateObjBrowser() diff --git a/tests/test_enforced_vertex.py b/tests/test_enforced_vertex.py index 19172cd..395c75a 100644 --- a/tests/test_enforced_vertex.py +++ b/tests/test_enforced_vertex.py @@ -5,7 +5,7 @@ import math import GEOM from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() r = 10 dist = 10 @@ -27,7 +27,7 @@ geompy.addToStudyInFather(box, left, "left") import SMESH from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() Mesh = smesh.Mesh(box, "Mesh") @@ -48,5 +48,5 @@ x, y, z = Mesh.GetNodeXYZ(id_node) assert("%.2f, %.2f, %.2f"%(x, y, z) == "%.2f, %.2f, %.2f"%(dist_coin, 0, dist_coin)) -salome.sg.updateObjBrowser(True) +salome.sg.updateObjBrowser() diff --git a/tests/test_periodicity_2D_precad.py b/tests/test_periodicity_2D_precad.py index 0bad8e8..771a0fc 100644 --- a/tests/test_periodicity_2D_precad.py +++ b/tests/test_periodicity_2D_precad.py @@ -11,7 +11,7 @@ import math import GEOM from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() O = geompy.MakeVertex(0, 0, 0) OX = geompy.MakeVectorDXDYDZ(1, 0, 0) @@ -61,7 +61,7 @@ geompy.addToStudyInFather(part, source_face, "source_face") import SMESH from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() Mesh = smesh.Mesh(part, "Mesh") @@ -107,4 +107,4 @@ checkProjection(gr_right, left_translated) checkProjection(gr_top, bottom_translated) if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(True) + salome.sg.updateObjBrowser() diff --git a/tests/test_periodicity_precad.py b/tests/test_periodicity_precad.py index c15afcb..f901cc1 100644 --- a/tests/test_periodicity_precad.py +++ b/tests/test_periodicity_precad.py @@ -5,7 +5,7 @@ import math import GEOM from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() simple = False @@ -90,7 +90,7 @@ geompy.addToStudyInFather(part, sources, "sources") import SMESH from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() Mesh = smesh.Mesh(part, "Mesh") @@ -136,5 +136,5 @@ checkProjection(gr_right, left_translated) checkProjection(gr_back, front_translated) checkProjection(gr_top, bottom_translated) -salome.sg.updateObjBrowser(True) +salome.sg.updateObjBrowser() diff --git a/tests/test_periodicity_reflexion_2D_precad.py b/tests/test_periodicity_reflexion_2D_precad.py index 975258f..cf44fb1 100644 --- a/tests/test_periodicity_reflexion_2D_precad.py +++ b/tests/test_periodicity_reflexion_2D_precad.py @@ -11,7 +11,7 @@ import math import GEOM from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() O = geompy.MakeVertex(0, 0, 0) OX = geompy.MakeVectorDXDYDZ(1, 0, 0) @@ -74,7 +74,7 @@ geompy.addToStudy(p_haut_droite, "p_haut_droite") import SMESH from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() Mesh = smesh.Mesh(part, "Mesh") @@ -122,5 +122,5 @@ checkProjection(gr_right, bottom_rotated) #salome.myStudy.SaveAs("test.hdf", 0) if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(True) + salome.sg.updateObjBrowser() diff --git a/tests/test_periodicity_reflexion_precad.py b/tests/test_periodicity_reflexion_precad.py index 8c9d7cd..2eeb6e9 100644 --- a/tests/test_periodicity_reflexion_precad.py +++ b/tests/test_periodicity_reflexion_precad.py @@ -6,7 +6,7 @@ import math import GEOM from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() simple = False @@ -77,7 +77,7 @@ geompy.addToStudy(p5, "p5") import SMESH from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() Mesh = smesh.Mesh(part, "Mesh") @@ -118,5 +118,5 @@ def checkProjection(gr, mesh_translated, tol=1e-7): checkProjection(gr_front, left_rotated) -salome.sg.updateObjBrowser(True) +salome.sg.updateObjBrowser() diff --git a/tests/test_periodicity_with_points_2D_precad.py b/tests/test_periodicity_with_points_2D_precad.py index 3dbc01d..f0b12c6 100644 --- a/tests/test_periodicity_with_points_2D_precad.py +++ b/tests/test_periodicity_with_points_2D_precad.py @@ -11,7 +11,7 @@ import math import GEOM from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() O = geompy.MakeVertex(0, 0, 0) OX = geompy.MakeVectorDXDYDZ(1, 0, 0) @@ -73,7 +73,7 @@ geompy.addToStudy(p_haut_droite, "p_haut_droite") import SMESH from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() Mesh = smesh.Mesh(part, "Mesh") @@ -120,6 +120,6 @@ def checkProjection(gr, mesh_translated, tol=1e-7): checkProjection(gr_top, bottom_translated) if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(True) + salome.sg.updateObjBrowser() diff --git a/tests/test_precad_intersections.py b/tests/test_precad_intersections.py index 0602459..7c13508 100644 --- a/tests/test_precad_intersections.py +++ b/tests/test_precad_intersections.py @@ -4,7 +4,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy ### ### GEOM component @@ -12,10 +11,10 @@ theStudy = salome.myStudy import GEOM from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() -geompy.init_geom(theStudy) +geompy.init_geom() Face_1 = geompy.MakeFaceHW(10, 10, 1) Translation_1 = geompy.MakeTranslation(Face_1, 10.0001, 0.0001, 0) @@ -39,7 +38,7 @@ geompy.addToStudyInFather(Partition_1, gr_vertices, "vertices") import SMESH from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() Mesh_1 = smesh.Mesh(Partition_1) @@ -66,4 +65,4 @@ nodesGroup = Mesh_1.MakeGroupByIds("nodes", SMESH.NODE, nodes) assert nodesGroup.Size() == 1, nodesGroup.GetIDs() if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(True) + salome.sg.updateObjBrowser() diff --git a/tests/test_precad_keep_gaps.py b/tests/test_precad_keep_gaps.py index 4ca8a06..242cbfb 100644 --- a/tests/test_precad_keep_gaps.py +++ b/tests/test_precad_keep_gaps.py @@ -4,7 +4,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy ### ### GEOM component @@ -12,10 +11,10 @@ theStudy = salome.myStudy import GEOM from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() -geompy.init_geom(theStudy) +geompy.init_geom() Face_1 = geompy.MakeFaceHW(10, 10, 1) Translation_1 = geompy.MakeTranslation(Face_1, 10.0001, 0.0001, 0) @@ -39,7 +38,7 @@ geompy.addToStudyInFather(Partition_1, gr_vertices, "vertices") import SMESH from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() Mesh_1 = smesh.Mesh(Partition_1) @@ -65,4 +64,4 @@ Mesh_1.MakeGroupByIds("nodes", SMESH.NODE, nodes) assert len(nodes) == 3, "We should have 3 nodes. We got %i. => The preprocessing has done something, but we did not ask him to."%len(nodes) if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(True) + salome.sg.updateObjBrowser() diff --git a/tests/test_proximity.py b/tests/test_proximity.py index a649832..c177ef5 100644 --- a/tests/test_proximity.py +++ b/tests/test_proximity.py @@ -4,7 +4,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy ### ### GEOM component @@ -16,7 +15,7 @@ import math import SALOMEDS -geompy = geomBuilder.New(theStudy) +geompy = geomBuilder.New() # Create a box box = geompy.MakeBoxDXDYDZ(100, 100, 100) @@ -50,7 +49,7 @@ geompy.addToStudyInFather(part, gr_spheres_faces, "spheres_faces") import SMESH, SALOMEDS from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(theStudy) +smesh = smeshBuilder.New() Mesh_1 = smesh.Mesh(part, "Mesh_part") BLSURF = Mesh_1.Triangle(algo=smeshBuilder.BLSURF) BLSURF_Parameters_1 = BLSURF.Parameters() @@ -86,4 +85,4 @@ if min_area > 1.5: raise Exception("Wrong minimal area on box. Proximity has not worked.") if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(True) + salome.sg.updateObjBrowser() diff --git a/tests/test_quadrangles_gradation.py b/tests/test_quadrangles_gradation.py index 2fd6f80..bb8c9a2 100644 --- a/tests/test_quadrangles_gradation.py +++ b/tests/test_quadrangles_gradation.py @@ -4,7 +4,7 @@ import salome import GEOM from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() import math @@ -76,7 +76,7 @@ for i, face in enumerate(faces): import SMESH from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() # Test gradation with quadrangles Mesh_1 = smesh.Mesh(part, "Mesh") @@ -150,6 +150,6 @@ if abs(nb_faces_2-nb_faces_2_ref) > nb_faces_tolerance: raise Exception("Number of faces of Mesh_2 incorrect") if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(True) + salome.sg.updateObjBrowser() diff --git a/tests/test_remove_tiny_edges.py b/tests/test_remove_tiny_edges.py index 1e863ee..426e37e 100644 --- a/tests/test_remove_tiny_edges.py +++ b/tests/test_remove_tiny_edges.py @@ -4,7 +4,7 @@ import salome import GEOM from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() import math @@ -64,7 +64,7 @@ for i, face in enumerate(faces): import SMESH from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() Mesh = smesh.Mesh(part, "Mesh") @@ -107,4 +107,4 @@ if min_length