TODO : Move myStudy from GEOM to KERNEL

This commit is contained in:
Anthony Geay 2021-01-13 16:45:47 +01:00
parent 01b0ad6701
commit 294f92ee45
5 changed files with 24 additions and 2 deletions

View File

@ -141,7 +141,7 @@ IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
ELSE() ELSE()
SWIG_ADD_LIBRARY(GeomHelper LANGUAGE python SOURCES ${GeomHelper_SOURCES}) SWIG_ADD_LIBRARY(GeomHelper LANGUAGE python SOURCES ${GeomHelper_SOURCES})
ENDIF() ENDIF()
SWIG_LINK_LIBRARIES(GeomHelper ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} GEOMEngine ) SWIG_LINK_LIBRARIES(GeomHelper ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} GEOMEngine ${KERNEL_SalomeKernelHelpers} ${KERNEL_SalomeDS} )
install(TARGETS _GeomHelper DESTINATION ${SALOME_INSTALL_LIBS}) install(TARGETS _GeomHelper DESTINATION ${SALOME_INSTALL_LIBS})
install(FILES ${GeomHelper_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) install(FILES ${GeomHelper_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}" ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_GeomHelper_REAL_NAME}") SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}" ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_GeomHelper_REAL_NAME}")

View File

@ -21,6 +21,8 @@
#include "GEOM_Gen_i.hh" #include "GEOM_Gen_i.hh"
#include "SALOME_Container_i.hxx" #include "SALOME_Container_i.hxx"
#include "SALOME_KernelServices.hxx"
#include "SALOMEDS_Study_i.hxx"
#include <cstring> #include <cstring>
@ -50,3 +52,11 @@ std::string BuildGEOMInstance()
CORBA::String_var ior = orb->object_to_string(zeRef); CORBA::String_var ior = orb->object_to_string(zeRef);
return std::string(ior.in()); return std::string(ior.in());
} }
std::string GetSessionInstance()
{
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

@ -20,3 +20,4 @@
#include <string> #include <string>
std::string BuildGEOMInstance(); std::string BuildGEOMInstance();
std::string GetSessionInstance();

View File

@ -24,4 +24,14 @@
%inline %inline
{ {
std::string BuildGEOMInstance(); std::string BuildGEOMInstance();
std::string GetSessionInstance();
} }
%pythoncode %{
def myStudy():
import SALOMEDS
import CORBA
orb=CORBA.ORB_init([''])
return orb.string_to_object(GetSessionInstance())
%}

View File

@ -837,7 +837,8 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
## @addtogroup l1_geomBuilder_auxiliary ## @addtogroup l1_geomBuilder_auxiliary
## @{ ## @{
def init_geom(self): def init_geom(self):
self.myStudy = salome.myStudy import GeomHelper
self.myStudy = GeomHelper.myStudy()
self.myBuilder = self.myStudy.NewBuilder() self.myBuilder = self.myStudy.NewBuilder()
# load data from the study file, if necessary # load data from the study file, if necessary