This commit is contained in:
Anthony Geay 2021-01-14 07:27:11 +01:00
parent 752cb307d6
commit 7911fd4a18
5 changed files with 31 additions and 6 deletions

View File

@ -49,6 +49,7 @@
#include <TopoDS_Wire.hxx>
#include <gp_Pnt.hxx>
#include "SALOME_KernelServices.hxx"
#ifdef WIN32
#include <windows.h>
@ -282,11 +283,8 @@ SALOME_LifeCycleCORBA* SMESH_Gen_i::GetLCC()
GEOM::GEOM_Gen_var SMESH_Gen_i::GetGeomEngine( bool isShaper )
{
Engines::EngineComponent_ptr temp =
GetLCC()->FindOrLoad_Component( isShaper ? "FactoryServer" : "FactoryServer",
isShaper ? "SHAPERSTUDY" : "GEOM" );
CORBA::Object_var temp = KERNEL::RetrieveCompo(isShaper ? "SHAPERSTUDY" : "GEOM");
myGeomGen = GEOM::GEOM_Gen::_narrow( temp );
return myGeomGen;
}

View File

@ -21,6 +21,8 @@
#include "SMESH_Gen_i.hxx"
#include "SALOME_Container_i.hxx"
#include "SALOME_KernelServices.hxx"
#include "SALOMEDS_Study_i.hxx"
#include <cstring>
@ -48,3 +50,11 @@ std::string BuildSMESHInstanceInternal(bool checkNS)
CORBA::String_var ior = orb->object_to_string(zeRef);
return std::string(ior.in());
}
std::string GetSessionInstanceInternal()
{
SALOMEDS::Study_var study = KERNEL::getStudyServantSA();
CORBA::ORB_ptr orb = KERNEL::getORB();
CORBA::String_var ior = orb->object_to_string(study);
return std::string(ior.in());
}

View File

@ -22,3 +22,4 @@
#include <string>
std::string BuildSMESHInstanceInternal(bool checkNS);
std::string GetSessionInstanceInternal();

View File

@ -31,4 +31,19 @@
{
return BuildSMESHInstanceInternal(checkNS);
}
std::string GetSessionInstance()
{
return GetSessionInstanceInternal();
}
}
%pythoncode %{
def myStudy():
import SALOMEDS
import CORBA
orb=CORBA.ORB_init([''])
return orb.string_to_object(GetSessionInstance())
%}

View File

@ -652,8 +652,9 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
self.geompyD=geompyD
self.SetGeomEngine(geompyD)
SMESH._objref_SMESH_Gen.UpdateStudy(self)
sb = salome.myStudy.NewBuilder()
sc = salome.myStudy.FindComponent("SMESH")
import GeomHelper
sb = GeomHelper.myStudy().NewBuilder()
sc = GeomHelper.myStudy().FindComponent("SMESH")
if sc:
sb.LoadWith(sc, self)
pass